【发布时间】:2010-04-30 20:34:15
【问题描述】:
我正在尝试使用 WCF 实现简单的安全客户端服务器通信。 当我启动 mt 服务器时一切正常,但是当我启动我的客户端时,我得到了这个错误: 错误:向https://localhost:800 发出 HTTP 请求时出错 0/交换服务。这可能是由于服务器证书是 在 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>
客户端和服务器的安全配置相同,我不需要服务器证书在那种安全(传输)中,为什么我会得到 这个例外????
谢谢...
【问题讨论】:
标签: wcf