gpt4 book ai didi

Azure 应用服务 "Could not find service certificate"(当它存在时)

转载 作者:行者123 更新时间:2023-12-02 23:31:50 24 4
gpt4 key购买 nike

我有一个使用 ACS 登录的 Azure 应用服务,如果有帮助的话,它是一个 MVC 5 站点。

它需要一个证书,假设指纹是AF47AF47AF47AF47AF47AF47AF47AF47AF47AF47

我通过门户上传:enter image description here

然后我添加了 WEBSITE_LOAD_CERTIFICATES/* 的应用程序设置 > 应用程序设置: enter image description here

在本地工作得很好(当然) - 当我将其加载到 Azure 上时,我得到:

Could not find service certificate: AF47AF47AF47AF47AF47AF47AF47AF47AF47AF47in the My store on CurrentUser HandlingInstanceID: 74429bcf-4e02-4e28-a261-329bf831f7ce An exception of type 'System.ArgumentNullException' occurred and was caught. ---------------------------------------------------------------------------- 06/27/2017 22:21:44 Type : System.ArgumentNullException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Value cannot be null.

(堆栈跟踪不可用)

知道我错过了什么吗?我也尝试在我的 Application_Start() 中加载证书,但没有成功 - 如果有人愿意,我可以发布该代码。

最佳答案

您似乎希望将证书上传到 Azure 应用服务 Web 应用中的证书集合,并在您站点的个人证书存储中的 MVC 应用程序中使用它,我上传了一个证书并添加了一个名为 WEBSITE_LOAD_CERTIFICATES 的应用设置,我可以使用以下代码在我的应用程序中访问证书,请引用它。

var thumbprint = "xxxxxxxxxxxxxx";

X509Certificate2 retVal = null;

X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
certStore.Open(OpenFlags.ReadOnly);

X509Certificate2Collection certCollection = certStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);

if (certCollection.Count > 0)
{
retVal = certCollection[0];
}

certStore.Close();

<强> remote debug web app它按预期工作。

enter image description here

此外,this article详细说明了在 Azure 应用服务中使用证书的步骤,请参阅。

关于Azure 应用服务 "Could not find service certificate"(当它存在时),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44791078/

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