Azure在Windows Server 2012工作角色上找不到证书



我目前正在尝试将我们的Azure云服务(Web和Worker角色)升级到.Net 4.5 Framework。为此,我们必须将Azure部署从Windows Server 2008更改为Windows Server 2012。

这要求我们在ServiceConfiguration文件中将操作系统系列从"1"更改为"3"。

当前系统

  • .Net 4.0
  • MVC3
  • EF 4.4
  • Azure Tools 1.6
  • Visual Studio 2010
  • Windows Server 2008

升级的系统

  • .Net 4.5
  • MVC4
  • EF 5
  • Azure Tools 1.8
  • Visual Studio 2012
  • Windows Server 2012

当我们查询Azure证书以确定我们是在"生产"还是"暂存"环境中时,我遇到了一个问题。

以下代码行可查找证书。为了清晰起见,缩短了。

// Open the certificate store for the current user.
X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
certStore.Open(OpenFlags.ReadOnly);
foreach (var cert in certStore.Certificates)
{
OutputToFile.OutputDataReceived("Cert - " + cert.FriendlyName + " -- Thumb -- " + cert.Thumbprint);
}
// Find the certificate with the specified thumbprint.
X509Certificate2Collection certCollection = certStore.Certificates.Find(
X509FindType.FindByThumbprint,
thumbPrint,
false);
// Close the certificate store.
certStore.Close();

正如您所看到的,我正在将证书详细信息打印到日志文件中,以查看是否出现故障。在OSFamily="1"(Windows Server 2008)上,此操作非常完美。它会找到证书。

但是,当我将OSFamily设置为"3"(Windows Server 2012)时,日志文件不会从循环中打印证书详细信息。

它在当地也很好用。

这是Windows Server 2012的问题还是Azure部署的问题?自从迁移到Windows Server 2012后,我必须对证书执行额外的步骤吗?

任何指示都将不胜感激。

我在这里找到了问题的答案:Azure自动缩放在本地工作,但在部署时不工作

在操作系统系列3中,WaWorkerHost在"网络服务"帐户下运行,该帐户没有私钥访问权限。所以我需要用提升的权限来运行这个角色。

最新更新