我在我的web.config中有这个部分:
<system.webServer> <modules runAllManagedModulesForAllRequests="true" /> <security> <authentication> <anonymousAuthentication enabled="true" /> <windowsAuthentication enabled="true" /> </authentication> </security> </system.webServer>
IIS7崩溃并抱怨自动化部分:
模块AnonymousAuthenticationModule
通知AuthenticateRequest
处理程序StaticFile
错误代码0x80070021
configuration错误此configuration部分不能用于此path。 当部分locking在父级别时,会发生这种情况。 locking可以是默认的(overrideModeDefault =“Deny”),也可以通过overrideMode =“Deny”或legacy allowOverride =“false”的位置标签进行显式设置。
Config Source 69: <authentication> 70: <anonymousAuthentication enabled="true" />
所以解决这个问题的常用方法是进入%windir%\system32\inetsrv\config\applicationHost.config
并解锁部分:
<sectionGroup name="system.webServer"> <sectionGroup name="security"> <section name="access" overrideModeDefault="Deny" /> <section name="applicationDependencies" overrideModeDefault="Deny" /> <sectionGroup name="authentication"> <section name="anonymousAuthentication" overrideModeDefault="Allow" /> <section name="basicAuthentication" overrideModeDefault="Allow" /> <section name="clientCertificateMappingAuthentication" overrideModeDefault="Allow" /> <section name="digestAuthentication" overrideModeDefault="Allow" /> <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Allow" /> <section name="windowsAuthentication" overrideModeDefault="Allow" /> </sectionGroup>
(或者, appcmd unlock config
)。
奇怪的事情:我已经这样做,它仍然抱怨。
我寻找位置(MVC是我的网站的名称,这是我使用的所有网站的根目录):
<location path="MVC" overrideMode="Allow"> <system.webServer overrideMode="Allow"> <security overrideMode="Allow"> <authentication overrideMode="Allow"> <windowsAuthentication enabled="true" /> <anonymousAuthentication enabled="true" /> </authentication> </security> </system.webServer> </location>
它仍然爆炸。 我为此感到困惑。 我无法从web.config中删除它,我想find根本问题。
有没有办法从IIS获取具体的信息哪个规则最终否认我?
编辑:我能够解决这个问题,使用IIS7pipe理控制台转到根(我的机器),然后单击“编辑configuration”,并解锁那里的部分。 不过,我想知道是否有更好的方法,因为我找不到它实际修改的文件。
完成了解决这个问题的这些步骤:
system.webServer/security/authentication/anonymousAuthentication
system.webServer/security/authentication/windowsAuthentication
这解决了我在Windows Server 2012,IIS 8.5上的错误。 还应该为其他版本工作。
.NET Extensibility 4.5
和ASP>NET 4.5
,这两个ISAPI条目 NET 3.5
, .NET 4.5
, ASP.NET 4.5
Web Server (all)
, Management Tools (IIS Management Console and Management Service)
, Windows
configurationlocking可以发生在:
Applicationhost.config(config string:MACHINE / WEBROOT / APPHOST)
网站Web.config文件(MACHINE / WEBROOT / APPHOST /网站名称)
(MACHINE / WEBROOT / APPHOST /网站名称/应用程序名称)的任何应用程序web.config文件
locking某个部分(部分:IISconfiguration部分,例如<asp>
)可以让您拒绝将这些设置configuration给层次结构中较低级别任何人的能力。
使用GUI的function委托thingo并没有错,而且与AppCMD的function非常相似,在覆盖范围内 – 在您所关注的任何级别的configuration中,为<location>
标记中的给定部分设置OverrideMode。
APPCMD可以用来解锁文件,但要注意它说的是在做什么 – 它不像GUI那么聪明。
将-commit:apphost
添加到您的APPCMD UNLOCK
命令目标的末尾Applicationhost.config,这是IIS操作的关键文件(从早期版本中replace元数据库;存储所有集中式设置,但允许在web.config中覆盖(如果这样))文件)。
如果没有-commit:apphost,APPCMD将会针对web.config文件的最接近的逻辑位置 – 无论是在网站还是应用程序级别,并且使用类似上述设置的configurationstring来指示它已经更改了设置。 (另外:你仍然可以只在子网站的目标设定,但承诺apphost – 它使用位置标签来完成)
所以,如果它说(内存释义)“更改提交到MACHINE / WEBROOT / APPHOST”,这意味着最高层的IIS层次结构。
如果它表示“提交给MACHINE / WEBROOT / APPHOST / Dodgy网站”,那就意味着它查找了Dodgy网站背后的物理path,并在该位置写了一个web.config文件(或更新了它)。
尝试在您的应用程序池,禁用32位应用程序支持IISpipe理器 – >应用程序池 – >select[您的应用程序池] – >高级设置 – >启用32位应用程序 – 将其更改为'假'
看看IIS – 这个configuration部分不能用在这个path(configurationlocking?)
接受的答案在Windows 10上完美地工作,它指示执行以下操作: