您的位置:首页 > 理论基础 > 计算机网络

Web Service 之 Exception: "The HTTP request is unauthorized with client authentication scheme......"

2014-04-23 17:40 417 查看
问题:

An exception of type'System.ServiceModel.Security.MessageSecurityException' occurred and wascaught.
Type :System.ServiceModel.Security.MessageSecurityException, System.ServiceModel,Version=4.0.0.0, Culture=neutral, ......
Message
: TheHTTP request is unauthorized with client authentication scheme 'Negotiate'. Theauthentication header received from the server was 'NTLM,Negotiate'.
Data :System.Collections.ListDictionaryInternal
TargetSite : VoidHandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage,System.Runtime.Remoting.Messaging.IMessage)
Stack Trace :
Server stack trace:
atSystem.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequestrequest, HttpWebResponse response, WebException responseException,HttpChannelFactory`1 factory)
atSystem.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequestrequest, HttpWebResponse response, HttpChannelFactory`1 factory, WebExceptionresponseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpantimeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message,TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,TimeSpan timeout)
atSystem.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessagemethodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessagemessage)
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData, Int32 type)
at XXX.DataAccess.MyWebService.MySoap.GetInfoList()
at XXX.Program.LoadAll() ind:\...\Program.cs:line XX

InnerException
Type: System.Net.WebException, System, Version=4.0.0.0, Culture=neutral,......
Message: The remote server returned an error: (401) Unauthorized.
Status: ProtocolError
Response: System.Net.HttpWebResponse
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Net.WebResponse GetResponse()
StackTrace : atSystem.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpantimeout)
原因:

访问web service时, 需要用户名和密码。

此时使用的用户名和密码不对。

解决方案:

修改可用的密码和用户名
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐