我们有一个客户端DLL试图访问的IIS托管的WCF服务。该服务在IIS中绑定为使用HTTPS,并设置为忽略客户端证书,这很好,但需要SSL导致问题。WCF需要SSL会导致“该HTTP请求被禁止客户端身份验证方案'匿名'”错误?
我真的不明白的是,调用其中一个服务的方法工作得很好,但调用另一个方法不起作用,并且出现以下错误:“HTTP请求被客户端身份验证方案禁止” Anonymous'。System.Net.WebException:远程服务器返回一个错误:(403)禁止。“
这可能是什么原因造成的?我对WCF很新,所以请让我知道我是否缺少任何东西或是否需要更多信息。
下面是一些业务配置代码:
this.Description.Behaviors.Add(new FaultConversionErrorHandler());
this.Description.Behaviors.Add(new LoggingErrorHandler());
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
ServiceEndpoint endpoint = this.AddServiceEndpoint(typeof(ILicenseService), binding, String.Empty);
SecurityEndpointBehavior securityEndpointBehavior = new SecurityEndpointBehavior();
endpoint.Behaviors.Add(securityEndpointBehavior);
这里是客户端如何引用服务:
EndpointAddress a = new EndpointAddress(licenseServiceUrl);
Binding b = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
LicenseServiceClient client = new LicenseServiceClient(b, a);
client.Endpoint.Behaviors.Add(new SecurityEndpointBehavior());
我遇到了一个与你密切的问题([我的问题])(http://stackoverflow.com/questions/16979346/wcf-service-stop-responding-unexpectedly-with-error-client-authentication-schem)) 你解决了你的问题吗?如果是的话,你能帮我解决我的问题吗? – srcnaks 2013-06-07 13:06:03