【问题标题】:Azure App Service "Could not find service certificate" when it is thereAzure App Service 存在时“找不到服务证书”
【发布时间】:2017-12-01 03:28:26
【问题描述】:

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

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

我是通过传送门上传的:

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

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

找不到服务证书: AF47AF47AF47AF47AF47AF47AF47AF47AF47AF47在我的商店上 当前用户处理实例 ID:74429bcf-4e02-4e28-a261-329bf831f7ce “System.ArgumentNullException”类型的异常发生并且是 捕捉。 -------------------------------------------------- -------------------------- 06/27/2017 22:21:44 类型:System.ArgumentNullException,mscorlib, 版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089 消息:值不能为空。

(堆栈跟踪不可用)

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

【问题讨论】:

  • 嗨,你解决了吗?我有完全相同的问题,我还没有找到解决方案。

标签: azure certificate azure-web-app-service wif acs


【解决方案1】:

您似乎想将您的证书上传到 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,它按预期工作。

另外,this article 解释了在 Azure 应用服务中使用证书的详细步骤,请参考。

【讨论】:

  • 这正是我正在做的,但它似乎在我的 CurrentUser 商店中,而不是我的 LocalMachine 商店中
  • 它始终加载到 CurrentUser 存储中,如 Fred 分享的文章中所述。无论如何,您都无法访问 LocalMachine 商店,因为应用程序没有这样做的权限。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-08-23
  • 1970-01-01
  • 2021-06-27
  • 1970-01-01
  • 1970-01-01
  • 2016-11-07
  • 2015-12-03
相关资源
最近更新 更多