Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net Azure在Windows Server 2012工作角色上找不到证书_.net_Azure_X509certificate_.net 4.5_Windows Server 2012 - Fatal编程技术网

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

.net Azure在Windows Server 2012工作角色上找不到证书,.net,azure,x509certificate,.net-4.5,windows-server-2012,.net,Azure,X509certificate,.net 4.5,Windows Server 2012,我目前正在尝试将Azure云服务(Web和工作者角色)升级到.NET4.5框架。 为此,我们必须将Azure部署从Windows Server 2008更改为Windows Server 2012 这要求我们在ServiceConfiguration文件中将OSFamily从“1”更改为“3” 现行制度 .NET4.0 MVC3 环境足迹4.4 Azure工具1.6 VisualStudio2010 Windows Server 2008 升级系统 .Net 4.5 MVC4 环境足迹5

我目前正在尝试将Azure云服务(Web和工作者角色)升级到.NET4.5框架。 为此,我们必须将Azure部署从Windows Server 2008更改为Windows Server 2012

这要求我们在ServiceConfiguration文件中将OSFamily从“1”更改为“3”

现行制度

  • .NET4.0
  • MVC3
  • 环境足迹4.4
  • Azure工具1.6
  • VisualStudio2010
  • Windows Server 2008
升级系统

  • .Net 4.5
  • MVC4
  • 环境足迹5
  • Azure工具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();
正如您所看到的,我正在将证书详细信息打印到日志文件中,以查看if在何处发生故障。 在OSFamily=“1”(Windows Server 2008)上,这项功能非常有效。它找到证书

但是,当我设置OSFamily=“3”(Windows Server 2012)时,日志文件不会打印循环中的证书详细信息

它在本地也能正常工作

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


非常感谢您的指导。

我在这里找到了问题的答案:


在操作系统系列3中,WaWorkerHost在“网络服务”帐户下运行,此帐户没有私钥访问权限。因此,我需要以提升的权限运行该角色

问题是,这只是为了了解您是在制作还是在登台?否则,我假设您已通过角色配置添加了证书?是的,我们使用该检查查看我们是否处于生产或暂存状态,因为我们不希望在暂存中的工作角色上运行某些作业。证书已添加到配置文件,并已上载到azure。我们可以在管理门户的证书下看到它。我们已经上传了100次,所有这些都可以使用OSFamily作为1,问题只存在于OSFamily作为3。您是否尝试过使用StoreLocation.LocalMachine而不是CurrentUser?我认为当你将证书上传到托管服务时,Azure就是在这里放置证书的。我怀疑这是一个重复的问题