gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 13:25:35 25 4
gpt4 key购买 nike

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

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

我已将 .pvk 上传到 azure

enter image description here

我已将其放入我的设置

enter image description here

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

enter image description here

然而,一旦我发布它,它仍然不起作用。这是我在服务模型的 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 WebApps 中指定证书存储 - 这些证书存储在 currentUser 中加载。将 storeLocation="CurrentUser"storeName="My" 添加到 serviceCertificate 元素。

关于wcf - 在 Azure 托管的 WCF 服务中找不到 X.509 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32444389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com