我在将站点部署到服务器时遇到错误。当尝试加载主页,或在IIS中的新站点上访问身份验证时,我收到错误:
配置错误:此配置部分不能在此路径中使用。当该部分被锁定在父级别时会发生这种情况。锁定是默认情况下(overrideModeDefault =“Deny”),或由locationMode =“Deny”或遗留allowOverride =“false”的位置标记显式设置。
更多细节可以在这里找到,在Scenario 7匹配我的十六进制错误代码。
上面链接站点上给出的解决方案是在applicationHost.config文件中的错误中提到的部分中为allowModeDefault设置Allow。就我而言,在system.webServer中的Security下。但是,如果我查看本地计算机上已正确部署该站点的applicationHost.config,该部分将设置为Deny。
如果这个解决方案是正确的,我的本地实例如何使用相同的web.config运行得很好?根据我的applicationHost.config,该部分应该被锁定,但事实并非如此。我宁愿不更改applicationHost.config文件,因为该服务器上还有许多其他站点在运行。还有其他解决方案吗?
我有同样的问题。不记得我在网上找到它的地方,但这就是我所做的:
顺便说一下,我正在使用Windows 7。
要解决此问题,请打开IIS Express applicationhost.config。此文件存储在C:\ Users [您的用户名] \ Documents \ IISExpress \ config \ applicationhost.config中
VS2015 +的更新:配置文件位置是$(solutionDir).vs \ config \ applicationhost.config
寻找以下几行
<section name="windowsAuthentication" overrideModeDefault="Deny" />
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
<add name="WindowsAuthenticationModule" lockItem="true" />
<add name="AnonymousAuthenticationModule" lockItem="true" />
将这些行更改为
<section name="windowsAuthentication" overrideModeDefault="Allow" />
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<add name="WindowsAuthenticationModule" lockItem="false" />
<add name="AnonymousAuthenticationModule" lockItem="false" />
保存并刷新Asp.net页面。
似乎在IIS Express和VS 2015中,$(solutionDir).vs \ config \ applicationhost.config中有applicationHost.config文件的副本,因此您需要在那里进行更改。看到这个链接:http://digitaldrummerj.me/iis-express-windows-authentication/
确保以下方式更改这些行:
<section name="windowsAuthentication" overrideModeDefault="Allow" />
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<add name="WindowsAuthenticationModule" lockItem="false" />
<add name="AnonymousAuthenticationModule" lockItem="false" />
在我的情况下,在.NET Framework功能下,服务器上没有启用“HTTP激活”。因此,对于Windows Server 2012,适用于我的解决方案是:
服务器管理器 - >添加角色和功能 - >功能 - >确保在要使用的.NET Framework版本下选中“HTTP激活”
Powershell启用这些功能的方法(Windows Server 2012 +) - 根据需要进行修剪:
Install-WindowsFeature NET-Framework-Core
Install-WindowsFeature Web-Server -IncludeAllSubFeature
Install-WindowsFeature NET-Framework-Features -IncludeAllSubFeature
Install-WindowsFeature NET-Framework-45-ASPNET -IncludeAllSubFeature
Install-WindowsFeature Application-Server -IncludeAllSubFeature
Install-WindowsFeature MSMQ -IncludeAllSubFeature
Install-WindowsFeature WAS -IncludeAllSubFeature
当我收到这条好消息时,我需要更改子文件夹上的SSL设置。在我的情况下,以下行动帮助了我。
打开C:\ Windows \ System32 \ inetsrv \ config \ applicationHost.config
并将值从overrideModeDefault =“Deny”更改为“Allow”
<sectionGroup name="system.webServer">
...
<sectionGroup name="security">
<section name="access" overrideModeDefault="Allow" />
</sectionGroup>
在我的情况下,我收到此错误,因为我在错误的配置文件上操作。
我这样做:
Configuration config = serverManager.GetWebConfiguration(websiteName);
ConfigurationSection serverRuntimeSection = config.GetSection("system.webServer/serverRuntime");
serverRuntimeSection["alternateHostName"] = hostname;
而不是正确的代码:
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection serverRuntimeSection = configApp.GetSection("system.webServer/serverRuntime", websiteName);
serverRuntimeSection["alternateHostName"] = hostname;
换句话说,我试图在网站的web.config上运行而不是全局文件C:\ Windows \ System32 \ inetsrv \ config \ applicationHost.config,它有一个网站的部分(或可以有一个部分)。我尝试更改的设置仅存在于applicationHost.config文件中。
在我的情况下,它是另一回事。
当我在新版本的Visual Studio中加载解决方案时,VS显然创建了一个新的项目特定的applicationhost.config文件:
MySolutionDir \ .VS \设置\对ApplicationHost.config
它开始使用新配置中的设置,而不是我已经自定义的全局IIS Express设置。 (\用户\%USER%\文件\ IISExpress \配置\对ApplicationHost.config)
在我的情况下,这是需要设置的设置。当然,它可能是你的另一个东西:
<section name="ipSecurity" overrideModeDefault="Allow" />
您还可以使用IIS管理器编辑这些设置。
照顾这个Learn IIS article:
使用IIS根目录中的功能委派:
然后,您可以控制每个机器级读/写权限,否则将为您提供overrideMode =“Deny”错误。
你能试试这个:
转到应用程序路径,您将收到拒绝错误,右键单击
属性 - >安全选项卡
在那里,更改权限并选中读取和写入复选框。然后它可以毫无错误地工作。
该错误表示配置部分已锁定在父级别。所以它不会直接1配置文件将解决问题,我们需要通过配置文件的层次结构来查看继承检查下面的链接来完成IIS中的文件层次结构和继承
https://msdn.microsoft.com/en-us/library/ms178685.aspx
因此,您需要按以下顺序检查应用配置设置
仔细检查所有这些配置,大约1到6,你应该找到它。
对于Windows Server 2008和IIS 7,过程类似。请参考:http://msdn.microsoft.com/en-us/library/vstudio/bb763178(v=vs.100).aspx
在添加角色服务中,您将看到“应用程序开发功能”
检查(启用)功能。我检查了所有。
在Vista Home Premium上安装IIS 7后收到同样的问题。为了纠正错误,我更改了位于Windows \ system32 \ inetsrv中的applicationHost.config文件中的以下值。
更改位于 - >部分中的所有以下值
<div mce_keep="true"><section name="handlers" overrideModeDefault="Deny" /> change this value from "Deny" to "Allow"</div>
<div mce_keep="true"><section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" /> change this value from "Deny" to "Allow"</div>
我有一个问题,我在输入override =“允许”值(这里已经提到过)......但是在x64位系统上.......我的32个记事本++是幻像保存它们。切换到记事本(x64位O / S上的64位应用程序)允许我保存设置。
见:
http://dpotter.net/technical/2009/11/editing-applicationhostconfig-on-64-bit-windows/
相关文字:
我正在运行的一个问题是我查看并可能编辑applicationHost.config。此文件位于%SystemRoot%\ System32 \ inetsrv \ config。看起来很简单。我能够轻松地从命令行中找到它,但是当我在我最喜欢的编辑器(Notepad ++)中加载它时,我找到了一个找不到文件的错误。原来,System32文件夹被重定向到32位应用程序到SysWOW64。似乎无法使用32位应用程序查看System32文件夹。去搞清楚。幸运的是,64位版本的Windows附带64位版本的记事本。尽管我不喜欢它,但至少它是有效的。
我遇到过同样的问题。
这对我有用在IIS 8中,您可以通过将服务器更改为IIS Express来解决此问题。转到debug-> Properties在Web中,从下拉列表中选择服务器作为IIS Express,然后重建解决方案
要在应用程序级别(Web.Config)进行更改:
请从web.config中删除Trust Level:
实际上,当我试图在托管服务器上托管我的网站时,我收到了这个错误,我无法控制他们的服务器。从我的应用程序web.config中删除上面的行解决了我的问题。
在我的情况下,除了浏览之外,我在尝试更新IIS中的身份验证设置时收到此错误。我可以通过从web.config本身删除身份验证设置来删除此错误。删除有问题的配置部分可能侵入性较小,在某些情况下比将服务器角色和功能更改过多更为可取:
删除部分:
<security>
<authentication>
<windowsAuthentication enabled="true" />
</authentication>
</security>
以下对我有用:
转到项目属性。网页标签。设置为本地IIS并设置特定页面。
我有Windows 7和Visual Studio 2013。
对于Windows Server 2012和IIS 8,过程类似。
应该安装Web Server (IIS)
和Application Server
,你也应该在Web Server (IIS) Support
下有可选的Application Server
。
我解决了这个问题
转到cmd并执行aspnet_regiis -i
希望对某人有所帮助。
浏览到“C:\ Windows \ System32 \ inetsrv \ config”(这里需要管理员权限)打开applicationHost.config
注意:在IISExpress和Visual Studio 2015中,applicationHost.config存储在$(solutionDir).vs\config\applicationhost.config
中
找到错误消息页面的“配置源”部分中显示的部分。对我来说,这通常是“模块”或“处理程序”
将overrideModeDefault
属性更改为Allow
所以整条线现在看起来像:
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
保存文件后,页面在我的浏览器中正常加载。
你需要解锁处理程序。这可以使用以下cmd命令完成:
%windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webServer/handlers
也许在IIS 8上收到此错误的人的另一个信息,在我的情况下是在Microsoft Server 2012平台上。我花了几个小时与其他在执行appcmd后冒出的错误作斗争。最后,我能够通过删除Web服务器角色并再次安装来修复它。
根据my answer to this similar issue;
尝试在服务器级解锁相关的IIS配置设置,如下所示:
我需要从命令提示符运行这两个命令:
%windir%/system32/inetsrv/appcmd unlock config /section:anonymousAuthentication
%windir%/system32/inetsrv/appcmd unlock config -section:windowsAuthentication
在带有IIS 8的Windows Server 2012上,我通过启用ASP.NET 4.5功能解决了这个问题:
然后关注ken's answer。