我试图使用WCF实现简单的安全客户端服务器通信。当im启动mt服务器时,每件事都可以,但是当im启动我的客户端im得到这个错误时:错误:在向https://localhost:800 0/ExchangeService发出HTTP请求时发生了一个错误。这可能是因为在HTTPS情况下,服务器证书没有正确配置HTTP.SYS。这也可能是由于客户端和服务器之间的安全绑定不匹配造成的。
这是服务器代码:
Uri address = new Uri("https://localhost:8000/ExchangeService");
WSHttpBinding binding = new WSHttpBinding();
//Set Binding Params
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
Type contract = typeof(ExchangeService.ServiceContract.ITradeService);
ServiceHost host = new ServiceHost(typeof(TradeService));
host.AddServiceEndpoint(contract, binding, address);
host.Open(); --这是客户机配置(app.config):
</client>
<bindings>
<wsHttpBinding>
<binding name="TradeWsHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"
proxyCredentialType ="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>客户端和服务器的安全配置都是相同的,和我在这种安全性(传输)中不需要服务器的证书,那么为什么我会得到这个异常呢?
谢谢..。
发布于 2010-04-30 12:34:15
看看你的代码:
Uri address = new Uri("https://localhost:8000/ExchangeService");您正在指定地址使用SSL (https),因此为此需要一个证书。要么使用http绑定,要么安装证书。
我将查看这个CodePlex链路上的应用程序场景和Tos部分,了解不同的配置以及如何配置它们的详细信息。
https://stackoverflow.com/questions/2730456
复制相似问题