我在我的网站的根目录中有一个内容管理应用程序,我正在尝试在子文件夹下使用不同的应用程序(计费应用程序).不幸的是,根网站的web.config干扰了子应用程序.
有没有办法只禁用子文件夹的web.config继承?
更新:
由Stephen Burris链接,使用<location>标记可以阻止部分Web配置的继承,如下所示:
<?xml version="1.0"?>
<configuration>
<configSections>
....
</configSections>
<location path="." inheritInChildApplications="false">
<appSettings>
....
</appSettings>
<connectionStrings/>
<system.web>
....
</system.web>
<system.codedom>
....
</system.codedom>
<system.webServer>
....
</system.webServer>
</location>
<runtime>
....
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)
在<configSections>与<runtime>部分将不接受被封装在标签...所以我想这不仅会大部分的工作.谁知道怎么做得更好?
我们在IIS 7.5中部署了一个ASP.NET网站(App 1).然后在该应用程序下创建另一个ASP.NET应用程序(App 2).但在App 2中,我不想继承web.configApp 1.
如果我尝试在App 1中执行以下操作,web.config:
<location path="." inheritInChildApplications="false">
<configSections>
<!-- etc -->
</configSections>
</location>
Run Code Online (Sandbox Code Playgroud)
它报告错误:
配置错误配置部分'configSections'无法读取,因为它缺少部分声明
如果我尝试做:
<remove name = "system.web.extensions" />
Run Code Online (Sandbox Code Playgroud)
它仍然报告相同的错误: