简体   繁体   中英

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"."

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."

We are running Windows Server 2008

Please help! Thankss!

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

Try changing your IIS applicationHost.Config file to something like this:

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

The file resides here: C:\\Windows\\System32\\inetsrv\\config\\applicationHost.config

You could also try setting the App Pool to .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

Then navigate to Internet Information Services > World Wide Web Services > Application Development Features

and tick 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. This worked for me on Windows 7 x64 Professional running IIS 7.5

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. In my case, this was requestFiltering. 2.Locate your applicationHost.config file. This is generally located at %SystemRoot%/system32/inetserv/config/applicationHost.config. 3.Within applicationHost.config, find the override section from step 1 and change it's overrideModeDefault to "Allow".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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