首页 > 其他分享 >【Azure 应用服务】应用代码中需要使用客户端证书访问服务接口,部署在应用服务后报错不能找到证书(Cannot find the X.509 certificate)

【Azure 应用服务】应用代码中需要使用客户端证书访问服务接口,部署在应用服务后报错不能找到证书(Cannot find the X.509 certificate)

时间:2023-02-24 21:02:03浏览次数:51  
标签:WEBSITE LOAD certificate 证书 报错 应用服务 CERTIFICATES find

问题描述

在应用中,需要访问另一个服务接口,这个接口需要使用客户端证书进行认证。在代码中使用 System.Security.Cryptography.X509Certificates 加载Window系统中 Current User\My 下的证书。

【Azure 应用服务】应用代码中需要使用客户端证书访问服务接口,部署在应用服务后报错不能找到证书(Cannot find the X.509 certificate)_参考资料

然后把证书通过App Service门户页面上传。

【Azure 应用服务】应用代码中需要使用客户端证书访问服务接口,部署在应用服务后报错不能找到证书(Cannot find the X.509 certificate)_App_02

但是,在访问应用时候,还是报错不能发现证书指纹

Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindByThumbprint', FindValue 'AAC***********************9F63EB' 

 

问题分析

根据对官方文档分析,得出一个结论,为了使运行在App Service实例上的应用能够读取到实例(如 Windows)中的证书,必须配置一个应用设置。​​WEBSITE_LOAD_CERTIFICATES​​ 

  • 如果只有一个证书,就为 ​​WEBSITE_LOAD_CERTIFICATES​​  设置 证书指纹值。
  • 如果有多个证书,​​WEBSITE_LOAD_CERTIFICATES​​  设置为  * 

问题即可解决!

 

参考资料

使证书可供访问 : ​​https://docs.azure.cn/zh-cn/app-service/configure-ssl-certificate-in-code#make-the-certificate-accessible​

 


当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

分类: ​​【Azure 应用服务】​

标签: ​​WEBSITE_LOAD_CERTIFICATES​​, ​​Cannot find the X.509 certificate​

标签:WEBSITE,LOAD,certificate,证书,报错,应用服务,CERTIFICATES,find
From: https://blog.51cto.com/u_13773780/6084373

相关文章