IIS express: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to

前端 未结 14 1775
旧巷少年郎
旧巷少年郎 2020-12-29 02:11

In Visual studio, Solution->Web.Project->Properties->Web, I have changed my Project Url from http://localhost:51123/ to http://localhost:51123/NewProj

相关标签:
14条回答
  • 2020-12-29 02:42

    My Project Url in Web tab inside project properties pointed to wrong url and I was not able to change it ("Would you like to create Virtual Directory?" and VS was locked in a loop (Yes -> Unable to create, No -> Operation Canceled) until I manually reverted Url to the (incorrect) state it was before. The solution was to run VS as Admin. I was able to change that url and everything started to work. Hope it helps!

    0 讨论(0)
  • 2020-12-29 02:43

    Also, ensure you don't have a duplicate web.config file in one of the parent folders (eg: a web.config backup file). That was the issue with mine!

    0 讨论(0)
  • 2020-12-29 02:43

    I had a problem of same type. Running my site published on IIS, the same error was shown.

    I saw a web.config file in the wwwroot folder (out of application folder). I removed this file and the application ran OK.

    Look for a web.config file placed in a wrong folder (above your folder application).

    Good luck!

    0 讨论(0)
  • 2020-12-29 02:45

    What worked for me. I deleted the {projectFolderParent}/.vs/config (you have to "show hidden folders/files)

    After deleting that, I restarted my computer.

    0 讨论(0)
  • 2020-12-29 02:46

    If you create an IIS website with the physical path the same as the project folder, and then use it create a virtual folder for the project, you are going to see this issue.
    Your Web.config file is being loaded twice.
    Instead as orjanto pointed out, create an empty folder and point the IIS website to it and then use it to create a virtual folder from Visual Studio.

    0 讨论(0)
  • 2020-12-29 02:49

    I had the same problem. It turned out that I had a different project that uses IISExpress with the same port number. Once I changed the project to use a different port number, the error went away.

    0 讨论(0)
提交回复
热议问题