IIS 配置错误-此配置节不能在此路径上使用

我得到下面的错误,当我尝试运行我的网站。

该网站托管在 Windows2012R2上。

配置错误: 此配置节不能用于此路径。当节在父级别锁定时会发生这种情况。锁定在默认情况下是(overrideModeDefault = “ Deny”) ,或者通过位置标记显式设置,覆盖模式 = “ Deny”或遗留 allowOverride = “ false”。

错误代码: 0x80070021

配置来源:

 60:     <httpErrors errorMode="Detailed" />
61:     <handlers>
62:       <remove name="ExtensionlessUrlHandler-Integrated-4.0" />

以下是我所有的尝试:

  1. 在 IIS 中使用“添加特性和角色”安装.Net 3.5
  2. 在 applicationHost 文件中,我做了以下代码更改:

    修改了部分处理程序、模块、匿名身份验证、 basicAuthentication 等,将 ModeDefault 从“拒绝”改为“允许”。

  3. 已经在.Net 3.5和4.5中完成了“ HTTP 激活”。

下面是我的 web 配置文件处理程序代码:

<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
  1. 在这个路径的特性窗口中安装了所有的特性: 互联网信息服务—— > 万维网服务—— > 应用程序开发功能—— > 除了 CGI 以外的所有功能都已经启用

  2. 在特性委托 ASP 只读之前,我把它改为读/写

  3. 使用命令提示解锁处理程序

但我仍然无法摆脱这个错误。 我的本地实例运行得非常好。此外,我有一个开发服务器,这个网站是工作,只有在我的生产服务器,我得到这个错误。

请帮助我找出可能引起这个问题的原因。

200430 次浏览

I think the better way is that you must remove you configuration from your web.config. Publish your code on the server and do what you want to remove directly from the IIS server interface.

Thanks to this method if you sucessfully do what you want, you just have to get the web.config and compare the differences. After that you just have to post the solution in this post :-P.

Follow the below steps to unlock the handlers at the parent level:

1) In the connections tree(in IIS), go to your server node and then to your website.

2) For the website, in the right window you will see configuration editor under Management.

3) Double click on the configuration editor.

4) In the window that opens, on top you will find a drop down for sections. Choose "system.webServer/handlers" from the drop down.

5) On the right side, there is another drop down. Choose "ApplicationHost.Config "

6) On the right most pane, you will find "Unlock Section" under "Section" heading. Click on that.

7) Once the handlers at the applicationHost is unlocked, your website should run fine.

Heres what worked for me, had a similar problem on my new laptop which had windows 10.

  • Search for "Turn windows features on or off"
  • Check "Internet Information Services"
  • Check "World Wide Web Services"
  • Check "Application Development Features"
  • Enable all items under this

try again, now it should work.

I had an applicationhost.config inside my project folder. It seems IISExpress uses this folder, even though it displays a different file in my c:\users folder

.vs\config\applicationhost.config

Most IIS sections are locked by default but you can "unlock" them by setting the attribute overrideModeDefault from "Deny" to "Allow" for the relevant section group by modifying the ApplicationHost.config file located in %windir%\system32\inetsrv\config in Administrator mode

enter image description here

Click on your project properties, go to the web section, from the Servers section, change from IIS express to Local IIS, it will create a virtual directory for you

I came across this thread and solve the issue by the below steps, My problem may be different. Hope this can help someone.

In Turn windows feature on and off navigate to server roles and select the least below mentioned items.

enter image description here

Cheers!

When I tried these steps I kept getting error:

  1. Search for "Turn windows features on or off"
  2. Check "Internet Information Services"
  3. Check "World Wide Web Services"
  4. Check "Application Development Features"
  5. Enable all items under this

Then i looked at event viewer and saw this error:Unable to install counter strings because the SYSTEM\CurrentControlSet\Services\ASP.NET_64\Performance key could not be opened or accessed. The first DWORD in the Data section contains the Win32 error code.

To fix the issue i manually created following entry in registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ASP.NET_64\Performance

and followed these steps:

  1. Search for "Turn windows features on or off"
  2. Check "Internet Information Services"
  3. Check "World Wide Web Services"
  4. Check "Application Development Features"
  5. Enable all items under this

Below is what worked for me:

  1. In IIS Click on root note "LAPTOP ____**".
  2. From option being shown in middle tray, Click on Configuration editor at bottom.
  3. In Top Drop Down select "system.webServer/handlers".
  4. At right window in Section Unlock Section.