Wcf &引用;HTTP请求未经客户端身份验证方案';匿名'&引用;
我有一个wcf应用程序。在我的本地计算机(windows 7和IIS 7.5)上测试,它可以工作。但在部署到dev服务器(WindowsServer2003,IIS6)之后。我收到了以下错误消息Wcf &引用;HTTP请求未经客户端身份验证方案';匿名'&引用;,wcf,wcf-binding,wcf-security,Wcf,Wcf Binding,Wcf Security,我有一个wcf应用程序。在我的本地计算机(windows 7和IIS 7.5)上测试,它可以工作。但在部署到dev服务器(WindowsServer2003,IIS6)之后。我收到了以下错误消息 The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory`1 factory)
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory`1.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.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)
at ICFIR.ProcessXmlMessage(String xmlDocument)
at CFIRClient.ProcessXmlMessage(String xmlDocument)
Inner Exception:
The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
我在谷歌上搜索了几个小时,发现了很多类似的问题,但没有一个能解决。这是我的web.config
<basicHttpBinding>
<binding name="ServiceSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="65536" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
它需要windows身份验证,您的服务器所在的域是否相同?如果是,则需要如下方式打开windows身份验证:
<security>
<transport clientCredentialType="Windows" proxyCredentialType="None" />
<message clientCredentialType="Windows" />
</security>
如果您不想打开它,您可以打开其他身份验证类型,如匿名或证书。请参阅:
注意:有时,如果您的代理服务器是从您正在调用的计算机上启用的,它也会遇到这种类型的问题。在这种情况下,请关闭代理或为代理提供身份验证。这就是Bravo11所说的。。。。 这确实困扰了我一段时间,但在尝试了上述多种不同的方法后,我终于找到了解决方案。在vs2010中创建服务时,如果要将Windows添加为安全设置,则需要将身份验证模式设置为Windows
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
</system.web>
您可以在服务的Web.config或IIS 6.0的属性->ASP.NET->编辑配置->身份验证->身份验证模式下拉列表中执行此操作
如果选择在IIS中执行此操作,则必须记住始终执行此操作,否则在再次发布时将重置此操作
希望这会对某人有所帮助。,我假设不需要身份验证。我不明白为什么它仍然需要windows身份验证。另一个要查看的内容是在您的IIS网站或web应用程序中,在“身份验证”下,确保您已启用适当的身份验证方法。