简体   繁体   中英

Co-existence of two web.config in web application sharing same base url

I have two distinct publishing folders for two ASP.NET Web Form Web Applications:

在此处输入图片说明

5.4 folder is configured to be routed to https://base url, while 5.3.2.2 is configured to be routed to https://base url/5.3.2.2. Each one has its own web.config. In IIS each one is distinct web application, being in same application pool. Newer version site works fine, but when calling to legacy pages, it happens that, reading ConnectionString an error occurs:

The entry 'connString' has already been added.

So basically it seems that they are not distinct web application after all, since it appears to read the "outer" web.config first. What am I doing wrong?

The machine.config and the web.config files form a hierarchy of configuration, where the lower inherits from the higher. So when you have a web.config in a virtual subdirectory of an application which itself has also a web.config, the lower web.config can only be used to modify what has been configured up the line (by using <remove /> and unique <add> tags, or defining sections that have not already been defined).

Further details and implications can be found in the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM