简体   繁体   English

在WCF中使用NetTcpBinding在自托管服务中配置传输安全性的异常

[英]Exception in configuring Transport Security in Self Hosted Service using NetTcpBinding in WCF

This is the configuration on the service side: 这是服务端的配置:

<endpoint binding="netTcpBinding" bindingConfiguration="TcpBinding" contract="a"></endpoint>
<binding name="TcpBinding">
  <security mode="Transport">
    <transport protectionLevel="EncryptAndSign" clientCredentialType="None">
    </transport>
  </security>
  <reliableSession enabled="false"/>
</binding>

<serviceBehaviors>
<behavior>
  <serviceCredentials>
    <serviceCertificate  storeName="My" storeLocation="LocalMachine" findValue="73 b9 d8 98 8d b6 54 bf fb ff 21 0b ac fc 04 19 37 16 71 5f" x509FindType="FindByThumbprint" />
  </serviceCredentials>
  <serviceMetadata httpGetEnabled="false"/>
  <serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>

I have created a self signed certificate following this link: https://msdn.microsoft.com/en-us/library/ff648498.aspx 我已经通过以下链接创建了自签名证书: https : //msdn.microsoft.com/zh-cn/library/ff648498.aspx

First I created a Certificate that I installed as Root Certificate Authority in Trusted Root Certification Authorities - named 'RootCA'. 首先,我创建了一个证书,该证书作为受信任的根证书颁发机构中的根证书颁发机构安装-名为“ RootCA”。 Then, I created another self signed certificate signed with this 'RootCA' which is issued to 'localhost'. 然后,我创建了另一个与此“ RootCA”签名的自签名证书,该证书已颁发给“ localhost”。

On the client side, I am using the same configuration elements as on service side. 在客户端,我使用的是与服务端相同的配置元素。 While opening the proxy, I am receiving the following exception: 打开代理时,我收到以下异常:

System.ServiceModel.Security.SecurityNegotiationException The X.509 certificate CN=localhost chain building failed. System.ServiceModel.Security.SecurityNegotiationException X.509证书CN = localhost链构建失败。 The certificate that was used has a trust chain that cannot be verified. 使用的证书具有无法验证的信任链。 Replace the certificate or change the certificateValidationMode. 替换证书或更改certificateValidationMode。 The revocation function was unable to check revocation for the certificate. 吊销功能无法检查证书的吊销。

What else is needed to make this running? 要运行此功能还需要什么?

include this in your client side in endpoint behaviours

    <endpointBehaviors>
          <behavior name="clientBehave">
            <clientCredentials>
               <serviceCertificate>              
<authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck"/>
              </serviceCertificate>
            </clientCredentials>
          </behavior>
        </endpointBehaviors>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM