我们在2.0网站上运行.NET 4.0虚拟目录没有任何问题,但相反的方式是给我们一些问题.这是可以理解的,但是有办法解决这个问题吗?它们运行在不同的应用程序池中...我们可以让虚拟目录跳过网站的web.config并直接转到machine.config吗?
我们收到以下错误:
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
Line 22: </appSettings>
Line 23: <system.web>
Line 24: <compilation debug="true" targetFramework="4.0" />
Line 25: <customErrors defaultRedirect="url" mode="RemoteOnly">
Line 26: <error statusCode="404" redirect="~/404.aspx"/>
Run Code Online (Sandbox Code Playgroud)
Ben*_*son 10
将以下内容添加到根web.config中
<location path="." inheritInChildApplications="false">
Run Code Online (Sandbox Code Playgroud)
是否可以在子文件夹中完全否定"更高"的web.config?
在你的root web.config中:
<location path="." inheritInChildApplications="false">
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
(Ben首先得到了这个,但我会留下这个答案,因为它指出了几个选择)