首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >请求失败,HTTP状态401:未经授权。

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

Stack Overflow用户
提问于 2017-10-20 02:17:10
回答 1查看 2.7K关注 0票数 0

当我在Windows10 v1607上调用一个web服务时,它对我来说很好,但是当我在Windows10 v1703上尝试相同的web服务时,它会给出以下错误:

代码语言:javascript
复制
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

有人有什么建议吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-20 02:39:24

好的,发现了问题-- Visual解决方案用于web应用属性Web -> Servers -> IIS Express,其值类似http://localhost:51243,用于调试很好,但当我发布时,它保留了这些设置,因此无法在生产服务器上工作。

为了解决这个问题,我用production切换到External Host

我仍然觉得有趣的是,Windows10 v1607并不关心这一点,而v1703却给出了401错误。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46841456

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档