简体   繁体   中英

Web.config inheritance and virtual directories

我已经创建了一个虚拟目录,并将其转换为自己的应用程序,并将其放入自己的应用程序池中,并且它仍然从根应用程序web.config文件继承设置,是否仍然可以阻止此情况的发生?

This is something that has caused me headaches for the past 18 years (since I work with .NET and IIS). This inheritance has never served any benefit but has caused numerous unexpected broken websites (you update the root and don't realize it breaks the child or you tested the child in an environment with a different root and when publishing it stops working).

So I decided today to search again and found something that works on a microsoft forum, but you need to change the parent not the child website. Put location tags around the system.web node of the web.config of the root website

<location  inheritInChildApplications="false">
<system.web>
 ...
</system.web>
</location>

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