【问题标题】:Can't stop child web application from inheriting parent's web.config无法阻止子 Web 应用程序继承父 Web.config
【发布时间】:2015-06-02 23:58:34
【问题描述】:

我查看了相关问题并遵循了他们的解决方案,但它仍然不适合我。任何帮助表示赞赏,谢谢。

我添加了一个 Web 应用程序作为虚拟目录(在父站点下)并转换为应用程序。它甚至有自己的应用程序池。父级是 .net 2.0,子级是 .net 4.0。

父母的Web.Config:

<configuration>
    <configSections>
        <sectionGroup name="system.web.extensions" ...>
            <sectionGroup name="scripting" ...>
                <section name="scriptResourceHandler" ... />
                <sectionGroup name="webServices" ...>
                    <section name="jsonSerialization" ... />
                    <section name="profileService" ... />
                    <section name="authenticationService" ... />
                </sectionGroup>
            </sectionGroup>
        </sectionGroup>
    </configSections>
    ...
</configuration>

孩子的 Web.Config

<configurations>
    <configSections>
            <clear/>      
    </configSections>
    <connectionStrings>
        ...
    </connectionStrings>
</configuration>

我的错误信息:

定义了重复的“system.web.extensions/scripting/scriptResourceHandler”部分

&lt;clear/&gt; 不起作用。我还尝试在&lt;configSections&gt; 之外引用 system.web.extensions 块,并将其包装在

中
<location path="." inheritInChildApplications="false">

还是不行。

我也尝试在孩子的 Web.Config 中删除这些部分,但仍然无法正常工作:

<configurations>
    <configSections>
            <remove name="system.web.extensions" />     
    </configSections>
    <connectionStrings>
        ...
    </connectionStrings>
</configuration>

在这一点上,我不知道还能尝试什么。有没有办法将子 Web 应用程序与父应用程序完全分开,但仍保留父应用程序的域? IE。我希望能够通过 www.parent.com/child 访问孩子的网站。

再次感谢。

【问题讨论】:

  • @ScottE 我尝试使用该线程上列出的解决方案,但它不能解决我的问题。如果您阅读我的问题,我提到用 .
  • Microsoft 有足够的文档说明如何并排运行 ASP.NET 2 和 4。你只需要通过搜索引擎查看官方指南。
  • 谢谢,@LexLi。你的回答把我带到了这个页面:asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc245724860。它帮助我将 移动到根 web.config (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG)。之后,我用 现在似乎可以工作了。

标签: asp.net


【解决方案1】:

这个链接帮助了我:http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc245724860

我将其移至根 web.config (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG)。之后,我用

将每个部分包装在父级的 web.config 中

&lt;location path="." inheritInChildApplications="false"&gt;

它现在似乎可以工作了。

【讨论】:

    猜你喜欢
    • 2020-08-23
    • 1970-01-01
    • 2010-10-21
    • 1970-01-01
    • 2016-03-11
    • 2012-10-01
    • 2011-09-05
    • 2012-08-30
    相关资源
    最近更新 更多