简体   繁体   English

在C#/ ASP.NET中,此配置错误是什么,我该如何处理?

[英]In C#/ASP.NET What is this config error and how do I deal with it?

I am getting an error: "The requested page cannot be accessed because the related configuration data for the page is invalid." 我收到一个错误:“由于该页面的相关配置数据无效,因此无法访问所请求的页面。”

In more detail, the config error is: "This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false"." 更详细地,配置错误是:“此配置节不能在此路径上使用。当该节被锁定在父级时会发生。锁定默认为(overrideModeDefault =“ deny”),或者由a显式设置。位置标记,其值为OverrideMode =“ Deny”或旧版allowOverride =“ false”。”

Also inside my visual studio, I get the error: "It is an error to use a section registered as allowDefinition = "MachineToApplication" beyond application level. This error can be used by a virtual directory not being configured as an application in IIS." 同样在我的Visual Studio内部,出现错误:“使用超出应用程序级别注册为allowDefinition =“ MachineToApplication”的节是错误的。此错误可由未在IIS中配置为应用程序的虚拟目录使用。

We are running Windows Server 2008 我们正在运行Windows Server 2008

Please help! 请帮忙! Thankss! 谢谢!

看起来您的应用程序中某处可能有两个Web配置文件?

Try changing your IIS applicationHost.Config file to something like this: 尝试将IIS applicationHost.Config文件更改为以下内容:

<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />

The file resides here: C:\\Windows\\System32\\inetsrv\\config\\applicationHost.config 该文件位于此处:C:\\ Windows \\ System32 \\ inetsrv \\ config \\ applicationHost.config

You could also try setting the App Pool to .NET 2.0. 您也可以尝试将应用程序池设置为.NET 2.0。 Were you doing any configuration changes to the application before this started happening? 您是否开始对应用程序进行任何配置更改?

Doug 道格

Try this if your in windows 7 this is the problem 90% of the time: You need to go to Control Panel > Programs > Turn Windows Features on or off 如果您在Windows 7中是90%的问题,请尝试此操作:您需要转到控制面板>程序>打开或关闭Windows功能

Then navigate to Internet Information Services > World Wide Web Services > Application Development Features 然后导航到Internet信息服务>万维网服务>应用程序开发功能

and tick ASP.NET. 并勾选ASP.NET。 This adds the relevant mappings to handle ASP.NET extensions correctly ad I believe is what using the Web Platform Installer is essentially doing for you. 这会添加相关的映射,以正确处理ASP.NET扩展。我相信,使用Web平台安装程序实质上就是为您完成的工作。 This worked for me on Windows 7 x64 Professional running IIS 7.5 这在运行IIS 7.5的Windows 7 x64 Professional上对我有用

If this isn't the solution : 1.Examine the web.config of your app to figure out which section has an override lock on it. 如果这不是解决方案,请执行以下操作:1.检查应用程序的web.config,以确定哪个部分具有覆盖锁定。 In my case, this was requestFiltering. 就我而言,这是requestFiltering。 2.Locate your applicationHost.config file. 2.找到您的applicationHost.config文件。 This is generally located at %SystemRoot%/system32/inetserv/config/applicationHost.config. 通常位于%SystemRoot%/ system32 / inetserv / config / applicationHost.config。 3.Within applicationHost.config, find the override section from step 1 and change it's overrideModeDefault to "Allow". 3.在applicationHost.config中,找到步骤1中的覆盖部分,并将其overrideModeDefault更改为“ Allow”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM