通过SSL连接到服务

时间:2020-10-30 11:07:48

标签: azure wcf ssl

一天中的好时光。使用OpenSSL创建了自签名证书。它在Azure中使用。将WCF项目发送到Azure时,发生错误:具有与https输入终结点关联的指纹的证书不包含私钥。我真的不明白为什么会这样。 cscfg文件:

<Certificates>
    <Certificate name="SampleCertificate"
        thumbprint="<Thumbprint>"
        thumbprintAlgorithm="sha1" />
</Certificates>

csdef文件:

<Certificates>
  <Certificate name="SampleCertificate"
               storeLocation="LocalMachine"
               storeName="CA"
               permissionLevel="limitedOrElevated" />
</Certificates>    
...
<Bindings>
  <Binding name="Endpoint1" endpointName="Endpoint1" />
  <Binding name="HttpsIn" endpointName="HttpsIn" />
</Bindings>
...
<Endpoints>
  <InputEndpoint name="Endpoint1" protocol="http" port="80" />
  <InputEndpoint name="HttpsIn" protocol="https" port="443"
         certificate="SampleCertificate" />
</Endpoints>

web.config:

<serviceCredentials>
<clientCertificate>
  <authentication 
    certificateValidationMode="PeerOrChainTrust" 
    revocationMode="NoCheck"/>
</clientCertificate>
<serviceCertificate 
  findValue="<Thumbprint>"
  storeLocation="LocalMachine"
  storeName="My"
  x509FindType="FindByThumbprint"/>
</serviceCredentials>
...
<security mode="Message">
    <message clientCredentialType="Certificate"/>
</security>
...
<host>
  <baseAddresses>
    <add baseAddress="https://<host>"/>
  </baseAddresses>
</host>

0 个答案:

没有答案