繁体   English   中英

在Azure托管的WCF服务中找不到X.509证书

[英]Cannot find the X.509 certificate in WCF service hosted in Azure

我正在尝试为WCF服务创建基于证书的身份验证平台,并且我已按照所有教程进行操作,并制作了证书并将其安装在IIS中,并且在本地运行良好,但是一旦将其发布到Azure,我得到例外

Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectName', FindValue 'CN=tempCert'.

我已经将.pvk上传到了蔚蓝

在此处输入图片说明

我把它放在我的设置中

在此处输入图片说明

而且我确保将其添加到网站的我的应用设置中

在此处输入图片说明

但是,一旦我发布它仍然不起作用。 这是我在Web.Config文件中用于服务模型的配置

  <system.serviceModel>
<services>
  <service name="clientSecurity">
    <endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding"
      name="wsHttpEndpoint" contract="uConnect.Web.IUConnectService" />
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="wsHttpEndpointBinding">
      <security>
        <message clientCredentialType="Certificate" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<client />
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceCredentials>
        <serviceCertificate findValue="CN=tempCert" x509FindType="FindBySubjectName" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>

正如我提到的那样,当我在本地运行它时,它工作得很好,它只有在将其发布到Azure时才会抛出异常。 自从我尝试修复此问题已有一段时间以来,任何帮助都将受到欢迎。

您需要在Azure WebApp中指定证书存储-将这些证书加载到currentUser中。 storeLocation="CurrentUser" storeName="My"到serviceCertificate元素。

暂无
暂无

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

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