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时, 需要用户名和密码。
此时使用的用户名和密码不对。
解决方案:
修改可用的密码和用户名
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时, 需要用户名和密码。
此时使用的用户名和密码不对。
解决方案:
修改可用的密码和用户名
相关文章推荐
- Web service: The HTTP request is unauthorized with client authentication scheme 'Anonymous'.....
- The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the serv
- HTTP request is unauthorized with client authentication scheme 'Anonymous'.
- Attribute value request.getParameter("digyso") is quoted with " which must be escaped when used within the value
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used within the value
- Web Service出现The request failed with HTTP status 401: Unauthorized错误
- Attribute value request.getParameter("itemID") is quoted with " which must be escaped when used with
- Web Service Error: “The request failed with HTTP status 401: Unauthorized.”-ZT
- Attribute value ("XXX") is quoted with " which must be escaped when used within the value 异常的修正
- org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the
- SVN 报错:svn: E155021: This client is too old to work with the working copy at..... (format '31').
- [openstack]"The request you have made requires authentication. (HTTP 401)l"
- 异常:"System.Net.WebException: 请求因 HTTP 状态 401 失败:Unauthorized。"
- The request failed with HTTP status 401: Unauthorized
- [原]在Oracle SOASUITE 10g Register ESB 报“The exception reported is: "javax.transaction.RollbackException: Timed out”问题的解决办法
- 访问File System的Web Service出现The request failed with HTTP status 401: Unauthorized错误
- IIS "Bad Request - Request Too Long. HTTP Error 400. The size of the request headers is too long."
- Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport e
- 异常处理Spring MVC "The request sent by the client was syntactically incorrect ()"
- Spring MVC "The request sent by the client was syntactically incorrect "解决办法