小编Rub*_*mez的帖子

WCF WebService无法从证书中获取PrivateKey

我已经创建了一个托管在IIS中的WCF服务,我已经创建了一个CA makecert和一个用于使用该服务来验证服务的证书HTTPS.有了这个证书,我就可以了.现在我正在尝试在服务中使用Message Security.

web.config我有下一个代码:

<serviceCredentials>
        <serviceCertificate findValue="192.168.1.230" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
        <clientCertificate>
          <authentication certificateValidationMode="ChainTrust" />
        </clientCertificate>
      </serviceCredentials>
Run Code Online (Sandbox Code Playgroud)

当我尝试通过Chrome等浏览器查看Web服务时,我收到了下一个错误System.Security.Cryptography.CryptographicException: KeySet does not exists.我查看内部异常,这就是我所看到的

[CryptographicException: El conjunto de claves no existe]
   System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer) +5368074
   System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle) +138
   System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair() +221
   System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey() +516
   System.ServiceModel.Security.SecurityUtils.GetKeyContainerInfo(X509Certificate2 certificate) +45
   System.ServiceModel.Security.SecurityUtils.EnsureCertificateCanDoKeyExchange(X509Certificate2 certificate) +76

[ArgumentException: Puede que el certificado 'CN=192.168.1.230' no tenga un clave privada capaz de intercambiar claves, o …
Run Code Online (Sandbox Code Playgroud)

c# ssl wcf web-services

2
推荐指数
1
解决办法
3156
查看次数

标签 统计

c# ×1

ssl ×1

wcf ×1

web-services ×1