WCF报错:带有协定的 ChannelDispatcher 无法打开其 IchannelListener

在启动WCF服务时,报错:

“net.tcp://localhost:8080/tcpTest”处带有协定“"ITestService"”的 ChannelDispatcher 无法打开其 IchannelListener。

在查看详细异常信息时:找到InnerException异常信息中,发现:


{"未提供服务证书。请在 ServiceCredentials 中指定服务证书。"}


解决方法:


将:


 <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="TestBind" maxReceivedMessageSize="65536000">
          <readerQuotas maxDepth="32" maxStringContentLength="819200" maxArrayLength="16384" maxBytesPerRead="8192" maxNameTableCharCount="16384" />
          <reliableSession inactivityTimeout="00:05:00" />
          <security mode="Message">

<security mode="Message">改为:


<security mode="Transport">


原因:

如果mode改为message方式,这种方式是对消息加密或签名,因此必须要注定证书。



也可以指定证书位置:


<behaviors>
    <serviceBehaviors>
      <behavior name="CustomValidator">
        <serviceCredentials>
          <serviceCertificate 
            findValue="8e f9 c6 6f 4e a0 0c 49 4f 84 69 fb de c6 a7 e1 79 01 5b 6e"
            x509FindType="FindByThumbprint" 
            storeLocation="CurrentUser" 
            storeName="My" />
        </serviceCredentials>
      </behavior>
    </serviceBehaviors>
    </behaviors>


参考链接:

WCF Security of Windows and Certificate

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值