【问题标题】:Exception during secure communication implementation安全通信实施期间的异常
【发布时间】: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


    【解决方案1】:

    看看你的代码:

    Uri address    = new Uri("https://localhost:8000/ExchangeService");
    

    您指定该地址使用 SSL (https),​​因此它需要为此目的提供证书。使用 http 绑定或安装证书。

    我会查看CodePlex Link 上的应用场景和操作方法部分,了解不同的配置以及如何配置它们的详细信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      • 2017-11-14
      • 2013-05-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多