代码之家  ›  专栏  ›  技术社区  ›  Merritt

我可以在asp.net 4.0站点中托管.net 2.0虚拟目录吗?

  •  7
  • Merritt  · 技术社区  · 15 年前

    我们得到以下错误:

    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"/>
    
    3 回复  |  直到 15 年前
        1
  •  10
  •   Coding Flow    15 年前

    将以下内容添加到根web.config中

    <location path="." inheritInChildApplications="false"> 
    
        2
  •  5
  •   Community Mohan Dere    9 年前

    Is it possible to completely negate a "higher" web.config in a subfolder?

    在根web.config中:

      <location path="." inheritInChildApplications="false">
        <system.web>      
            <compilation debug="true" targetFramework="4.0" />
        </system.web>
      </location>
    

    (本首先谈到了这个问题,但我会留下这个答案,因为它指出了一些备选方案)

        3
  •  1
  •   Josh    12 年前

    这是一个web.config继承问题,您无法克服 <location> 指令。

    我们在一个应用程序上遇到了类似的关于重复配置指令的错误。 经过调查,看起来是因为 this issue .

    简而言之,我们的根网站是ASP.NET3.5(它是2.0,添加了特定的库),我们有一个子应用程序是ASP.NET4.0。

    web.config继承使ASP.NET 4.0子应用程序继承父ASP.NET 3.5应用程序的web.config文件。

    <configSections> 节点。

    这个 <位置> <

    1. 确定在根应用程序中不需要它们,或者
    2. 将父应用程序升级到ASP.NET 4.0(这样它就可以访问根web.config的configSections)
    推荐文章