繁体   English   中英

使用以下搜索条件无法找到X.509证书

[英]Cannot find the X.509 certificate using the following search criteria

我正在尝试设置托管在Windows Azure Web角色中的WCF服务。 我已经为邮件安全配置了服务,因此在使用不安全的通道时,我想使用X509证书加密邮件。 不幸的是,我无法让它在Azure上工作。 在当地,我设法正确设置一切。

这是WCF服务的web.config:

<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceCredentials>
        <serviceCertificate findValue="CN=peterpan.cloudapp.net" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Skillconomy.Cloud.CheckInService.UserValidator, Skillconomy.Cloud.CheckInService" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>

我已在Web角色中配置了证书:

在此输入图像描述

我已经在Azure门户中上传了证书:

在此输入图像描述

我得到了例外:

使用以下搜索条件找不到X.509证书:StoreName'My',StoreLocation'LocalMachine',FindType'FindBySubjectName',FindValue'CN = xyz.cloudapp.net'。 描述:执行当前Web请求期间发生未处理的异常。 请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.InvalidOperationException:无法使用以下搜索条件找到X.509证书:StoreName'My',StoreLocation'LocalMachine',FindType'FindBySubjectName',FindValue'CN = xyz.cloudapp.net'。

我在这里错过了什么?

这个问题通过改变来解决:

<serviceCertificate findValue="CN=peterpan.cloudapp.net" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />

<serviceCertificate findValue="CN=peterpan.cloudapp.net" />

没有完全解释错误,但至少它有效...

如果你打算使用x509FindType =“FindBySubjectName”,那么findValue应该是“peterpan.cloudapp.net” - 没有CN =

暂无
暂无

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

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