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

前端 未结 14 1994
旧巷少年郎
旧巷少年郎 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:53

    All web.config files work off multiple cascading levels of inheritance at the machine, IIS, project, and folder level locations, with each providing a higher degree of specificity.

    If you're getting this error, it means you've either:

    1. Added the same key twice in the same file (unlikely since you would've seen it)
    2. The same key already exists in a separate file higher up the inheritance chain

    There can be a lot of different root causes for #2, but if you want to side step them, you can just remove any previous declarations and then re-add your own at that level (I'd pay good money for an upsert feature).

    So just add tags like this for any offending elements:

    
      
    
        
        
        
    
        
        
        
    
      
    
    

提交回复
热议问题