我已经创建了一个虚拟目录并将其转换为它自己的应用程序并将其放入它自己的应用程序池中,它仍然从根应用程序 web.config 文件继承设置,它无论如何要阻止这种情况发生?
1 回答
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>