使用注册为 allowDefinition='MachineToApplication' 的部分超出应用程序级别时出错 [英] Error to use a section registered as allowDefinition='MachineToApplication' beyond application level

查看:21
本文介绍了使用注册为 allowDefinition='MachineToApplication' 的部分超出应用程序级别时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的部分是错误的.

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.

我的/portal/目录中所有 aspx 页面的第一行都有这个错误消息,我知道这是一个常见的错误消息.我已经用谷歌搜索了这个错误消息,而且我看到很多帖子告诉我将/portal/文件夹配置为 IIS 中的应用程序(我有),还有更多帖子告诉我我已经嵌套了 web.configs(但是这些帖子都没有提供解决方案的指导).

The top line in all of my aspx pages in my /portal/ directory has this error message, and I know it's a common one. I have googled this error message to no end, and I see a lot of posts telling me to configure the /portal/ folder as an application in IIS (which I have), and more posts telling me I have nested web.configs (but none of the postings offer guidance toward a solution).

我的设置是在我的根目录中有一个 web.config,然后我尝试在/portal/directory 中创建一个公司门户./portal/目录有它自己的(必要的)web.config.

My setup is that I have a web.config in my root directory, and then I'm trying to make a company portal, in the /portal/directory. The /portal/ directory has its own (necessary) web.config.

我的 web.config 第 50 行是这样的:

My web.config line 50 is like this:

    <customErrors mode="Off" defaultRedirect="customerrorpage.aspx"/>
    <anonymousIdentification enabled="true"/>
    <authentication mode="Forms"/>
    <membership defaultProvider="MyProvider">

所以我有 domain.com/web.config 和 domain.com/portal/web.config ...所以我的 domain.com/portal/default.aspx 页面将无法加载.

So I have domain.com/web.config AND domain.com/portal/web.config ... so my domain.com/portal/default.aspx page will not load.

解决这个问题的真正方法是什么?我是否能找到一种方法将我的根 web.config 与我的/portal/目录 web.config 合并,或者我在这里离基地很远?

What is the real solution to this? Do I somehow find a way to merge my root web.config with my /portal/ directory web.config, or am I way off base here?

任何指导将不胜感激!

推荐答案

仅供参考;一个 ASP.NET 网站的配置信息在一个或多个 Web.config 文件中定义.配置设置以分层方式应用.有一个全局"Web.config 文件,它说明了 Web 服务器上所有网站的基线配置信息;此文件位于 %WINDIR%Microsoft.NetFrameworkversionCONFIG 文件夹中.您还可以在网站的根文件夹中拥有一个 Web.config 文件.此 Web.config 文件可以覆盖全局"Web.config 文件中定义的设置,或添加新设置.此外,您网站的子文件夹中可能有 Web.config 文件,这些文件定义了新的配置设置或覆盖了在层次结构中较高的 Web.config 文件中定义的配置设置.

Just for background information; Configuration information for an ASP.NET website is defined in one or more Web.config files. The configuration settings are applied in a hierarchical manner. There's a "global" Web.config file that spells out the baseline configuration information for all websites on the web server; this file lives in the %WINDIR%Microsoft.NetFrameworkversionCONFIG folder. You can also have a Web.config file in the root folder of your website. This Web.config file can override settings defined in the "global" Web.config file, or add new ones. Additionally, you may have Web.config files in the subfolders of your website, which define new configuration settings or override configuration settings defined in Web.config files higher up in the hierarchy.

Web.config 中的某些配置元素不能在应用程序级别之外定义,这意味着它们必须在全局"Web.config 文件或网站根文件夹中的 Web.config 文件中定义.<authentication> 元素就是一个这样的例子.上述错误消息表明网站的其中一个子文件夹中有一个 Web.config 文件,其中包含无法在应用程序级别之外定义的这些配置元素之一.

Certain configuration elements in Web.config cannot be defined beyond the application level, meaning that they must be defined in the "global" Web.config file or in the Web.config file in the website's root folder. The <authentication> element is one such example. The above error message indicates that there is a Web.config file in one of the website's subfolders that has one of these configuration elements that cannot be defined beyond the application level.

来源:http://scottonwriting.net/sowblog/archive/2010/02/17/163375.aspx

您已正确识别出两种可能的方法.

You have correctly identified the 2 possible approaches.

1 - 根据您的第二个 web.config 的内容以及您的设置是否允许(即相同的身份验证方法) - 添加 <authentication> 设置和任何其他应定义的元素全局进入顶部 web.config

1 - Depending on the contents of your second web.config and if your setup would allow (i.e same authentication method) - add the <authentication> settings and any other elements that should be define globally into the top web.config

2 - 如果您无法合并 web.config 内容,那么您应该能够按照下面此链接存档链接中包含的步骤将子文件夹转换为 IIS 中的 Web 应用程序.原来的链接已经失效了.(参见 归档)希望这会有所帮助.

2 - If you cannot merge then web.config contents then you should be able to turn the sub-folder into a web application in IIS by following the steps contained in this link archived link below. The original link is no longer working. (see archived) Hope this helps.

这篇关于使用注册为 allowDefinition='MachineToApplication' 的部分超出应用程序级别时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆