Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
705 views
in Technique[技术] by (71.8m points)

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

In Visual studio, Solution->Web.Project->Properties->Web, I have changed my Project Url from http://localhost:51123/ to http://localhost:51123/NewProjectName and I keep getting this error:

"Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to ...." on every module added.

Adding a remove tag works but then it should have been a problem even before i changed the url. Any suggestions?

question from:https://stackoverflow.com/questions/18506826/iis-express-cannot-add-duplicate-collection-entry-of-type-add-with-unique-key

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think IIS Express probably has 2 <application>-blocks and both will be pointing to the same physicalPath.

Go to the IIS Express config file in: My DocumentsIISExpressconfigapplicationhost.config

Search for NewProjectName

Change the physicalPath for the root application to something else. Point it to an empty folder.

Should look something like this:

<site name="NewProjectName" id="1">
  <application path="/" applicationPool="Clr4IntegratedAppPool">
    <virtualDirectory path="/" physicalPath="c:Temp" />
  </application>
  <application path="/NewProjectName" applicationPool="Clr4IntegratedAppPool">
    <virtualDirectory path="/" physicalPath="c:sourcecodeNewProjectName" />
  </application>
  <bindings>
    <binding protocol="http" bindingInformation="*:51123:localhost" />
  </bindings>
</site>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...