【问题标题】:ASP.NET, two Web.ConfigASP.NET,两个 Web.Config
【发布时间】:2019-10-12 23:32:27
【问题描述】:

我有一个 .NET 应用程序,其中包含所有 aspx 页面和根文件夹中的主 web.config,但我现在有一种情况,我需要一个类似门户的部分供其他用户使用。我创建了一个新文件夹,其中包含自己独特的 aspx 页面和第二个 web.config。

我特别需要第二个 web.config 来为这个门户部分设置 <authentication><forms loginUrl="" defaultUrl="> 以及 <authentication>

我已经按照我创建第一个 web.config 的方式实现了第二个 web.config,我收到以下错误消息:

    It is an error to use a section registered as allowDefintion='MachineToApplication' 
    beyond application level. This error can be caused by a virtual directory not being 
    configured as an application in IIS.

现在我认为主 web.config 文件与其文件夹中的第二个 webconfig 冲突。我不知道如何解决这个问题,我已经看到了关于它如何工作的理论,但没有可靠的代码。

感谢您的任何建议和您的时间,非常感谢。

【问题讨论】:

    标签: asp.net .net web-config


    【解决方案1】:

    在 IIS 中,在您的主应用程序下创建一个虚拟目录。本地 web.config 将覆盖主 web.config 中的内容,但仍将主 web.config 用于其他所有内容(即 ConnectionStrings、编码等)。

    【讨论】:

      猜你喜欢
      • 2010-10-05
      • 1970-01-01
      • 2010-10-18
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多