IIS Express HTTP Error 401.2 - Unauthorized

好久不见. 提交于 2019-11-30 06:11:40
vikomall

Make sure you have something like below in your applicationhost.config file

<windowsAuthentication enabled="true">
  <providers>
    <add value="Negotiate" />
    <add value="NTLM" />
   </providers>
</windowsAuthentication>

This file is probably in %HOMEPATH%\Documents\IISExpress\config\

I've had such a problem in VS 2013 with IIS 8.0 Express when I wanted to update Service Reference. A dialog popped up asking for username/password. A strange substring was added to the service url:

_vti_bin/ListData.svc

I started configuring windows authentization as mentioned in some posts in this page in applicationhost.config. Finally, the working configuration can't have Negotiate provider:

<windowsAuthentication enabled="true">
  <providers>
    <!--<add value="Negotiate" />-->
    <add value="NTLM" />
   </providers>
</windowsAuthentication>

And the anonymous authentication must be disabled:

<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />

Try adding the following to your web.config.

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
        <security>
            <authentication>
                <windowsAuthentication enabled="true" />
            </authentication>
        </security>
</system.webServer>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!