错误403:禁止。客户端身份验证方案“Anonymous”禁止HTTP请求

时间:2009-11-30 16:52:42

标签: c# java web-services

调用java Web服务时出现此错误。我使用与我团队其他成员相同的来源,他们都能称之为没问题吗? 这是堆栈跟踪:

30 Nov 2009 16:38:50,970 [4] ERROR - Error calling web service: System.ServiceModel.Security.MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Anonymous'. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory)
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

4 个答案:

答案 0 :(得分:3)

我认为Web服务的服务器端是用java实现的,但无论如何这都无关紧要。

也许有一个基于IP的授权层?

答案 1 :(得分:0)

将一个HTTP嗅探器挂钩到循环中,看看他们在请求中发送的内容与您发送的内容相比。看起来无论出于何种原因,您的请求都没有向他们发送适当的身份验证。

请注意,根据设置的方式,这可能不依赖于您的源树,并且可能会推迟到您计算机上的IE的Internet设置。

答案 2 :(得分:0)

此错误表示您正在进行跨域调用,但您在WCF传输中没有任何安全设置(匿名访问)。

请查看此示例,了解如何设置证书身份验证,

http://msdn.microsoft.com/en-us/library/ms751427.aspx

答案 3 :(得分:0)

我已经解决了。

我看到服务主机中的WSHttpBinding实际上正在检查受信任的人是否存在传入的客户端请求证书。 因此,远程证书应该出现在服务器的可信任人员中。

或添加CustomValidator并覆盖该行为。祝你好运