使用Windows集成驗證,無論使用IIS仍是IIS express,當同一個域進行訪問時,可能出現401錯誤,錯誤的處理辦法:web
1. IIS(摘自MSDN的)express
IIS 7 was difficult for figuring out why i was getting the 401 - Unauthorized: Access is denied due to invalid credentials... until i did this...windows
1.) Open IIS and select the website that is causing the 401app
2.) Open the "Authentication" property under the "IIS" headeride
3.) Click the "Windows Authentication" item and click "Providers"this
4.) For me the issue was that Negotiate was above NTLM. I assume that there was some kind of handshake going on behind the scenes, but i was never really authenticated. I moved the NTLM to the top most spot, and BAM that fixed it.spa
2.IIS expressserver
相應的IIS express你必須找到其配置文件:C:\Users\v-xiaofz\Documents\IISExpress\config\applicationhost.configci
而後設置以下:get
<authentication>
<anonymousAuthentication enabled="false" userName="" />
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="false" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="false">
</iisClientCertificateMappingAuthentication><windowsAuthentication enabled="true">
<providers>
<add value="NTLM" />
<add value="Negotiate" />
</providers>
</windowsAuthentication></authentication>
上面紅色部分很是關鍵,出現401錯誤就是由於兩個交換位置了