HTTP状态401请求失败:未经授权。

HTTP状态401请求失败:未经授权。

问题描述:

当我呼吁在Windows 10 v1607它工作正常,我,但是当我尝试在Windows 10 v1703相同的Web服务,它给了我这个错误Web服务:HTTP状态401请求失败:未经授权。

The request failed with HTTP status 401: Unauthorized. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized. 

Source Error: 


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 



[WebException: The request failed with HTTP status 401: Unauthorized.] 
    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +237136 
    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +267 
    CPR.Apps.CPMS.ServiceWrapper.CPMSProxy.CPMSService.GetUserGroupTasks(User& user) +138 
    CPR.Apps.CPMS.ServiceWrapper.WebAppServiceWrapper.GetUserGroupTasks(User& cpmsUser) +111 
    CCPS.App.Web.UI.Global.Session_Start(Object sender, EventArgs e) +145 
    System.Web.SessionState.SessionStateModule.CompleteAcquireState() +380 
    System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1250 
    System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +631 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134 

请注意,它的工作原理如果我将Web服务身份验证设置为匿名,但从安全角度来看这是不可接受的。目前,安全设置是asp.net模拟和Windows身份验证。我也有webService.UseDefaultCredentials = true

有没有人有任何建议?

OK,发现了问题 - Visual Studio解决方案已经为Web应用程序性能Web - >Servers - >IIS Express与像http://localhost:51243的值进行调试工作正常,但是当我发布它让那些设置,所以它会不在生产服务器上工作。

要解决这个问题,我切换它External Host与生产URL。

我仍然觉得有趣的是,Windows 10 v1607不关心这个,而v1703给出了401错误。