代码之家  ›  专栏  ›  技术社区  ›  Zachary Scott

如何解决子Web应用程序上嵌套的冲突web.config条目?

  •  2
  • Zachary Scott  · 技术社区  · 15 年前

    我正试图运行一个标准的潜台词博客引擎作为一个标准的微软MVC网站的子应用程序。web.configs有冲突的条目。我知道有一些方法可以限制web.config中这些条目的范围,但我还没有使其生效。有什么想法吗?我试着用 <location> 标记,但它不能存在于根XML级别。尝试使用 <remove> 声明似乎被简单地忽略了。细节:

    子应用程序错误:

    Section or group name 'system.web.extensions' is already defined. Updates to this may only occur at the configuration level where it is defined.

    子应用程序代码:

    <sectionGroup name="system.web.extensions"
    type="System.Web.Configuration.SystemWebExtensionsSectionGroup, 
    System.Web.Extensions, Version=1.0.61025.0, 
    Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    

    父应用程序代码:

    <sectionGroup name="system.web.extensions"
    type="System.Web.Configuration.SystemWebExtensionsSectionGroup, 
    System.Web.Extensions, Version=3.5.0.0, 
    Culture=neutral, PublicKeyToken=31BF3856AD364E35">`
    
    1 回复  |  直到 15 年前
        1
  •  3
  •   Bryan    15 年前

    是什么阻止您在子应用程序配置中删除该节组?那样可以吗…?

    如果出现问题,请尝试为System.Web.Extensions添加运行时程序集重定向:

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>