当我在Windows10 v1607上调用一个web服务时,它对我来说很好,但是当我在Windows10 v1703上尝试相同的web服务时,它会给出以下错误:
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。
有人有什么建议吗?
发布于 2017-10-20 02:39:24
好的,发现了问题-- Visual解决方案用于web应用属性Web -> Servers -> IIS Express,其值类似http://localhost:51243,用于调试很好,但当我发布时,它保留了这些设置,因此无法在生产服务器上工作。
为了解决这个问题,我用production切换到External Host。
我仍然觉得有趣的是,Windows10 v1607并不关心这一点,而v1703却给出了401错误。
https://stackoverflow.com/questions/46841456
复制相似问题