如何使用签名证书将 asp.net 4.5 身份服务器应用程序部署到 Azure
How to deploy asp.net 4.5 identity server application to azure with signing certificates
我有 c# asp.net 4.5 identityserver v3 web 应用程序。我将其用作我的授权服务器。我正在使用 Default Signing Certificates
中提到的默认示例签名证书
现在我想将它部署到 azure 中。我是这个 azure 主机的新手。
任何人都可以帮助我如何使用这些证书将此 webapp 部署到 azure 吗?
我尝试了以下代码。指纹是我上传到天蓝色网站的证书。
public X509Certificate2 LoadCertificate(string filename, string password)
{
X509Certificate2 cert = null;
X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
certStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certCollection = certStore.Certificates.Find(
X509FindType.FindByThumbprint,
"6B7ACC520305BFDB4F7252DAEB2177CCd091FAAE1",
false);
if (certCollection.Count > 0)
{
cert = certCollection[0];
}
if(cert == null)
{
var path = $@"{AppDomain.CurrentDomain.BaseDirectory}{filename}";
cert = new X509Certificate2(path, password);
}
return cert;
}
谢谢
Can anyone please help me how to deploy this webapp to azure with these certificates?
如果你想在CurrentUser下安装这些证书。您可以从 Azure 门户 upload the .pfx to the Azure WebApp 并添加名为 WEBSITE_LOAD_CERTIFICATES
的应用程序设置
Add an app setting called WEBSITE_LOAD_CERTIFICATES and set its value to the thumbprint of the certificate. To make multiple certificates accessible, use comma-separated thumbprint values. To make all certificates accessible, set the value to *.
我有 c# asp.net 4.5 identityserver v3 web 应用程序。我将其用作我的授权服务器。我正在使用 Default Signing Certificates
中提到的默认示例签名证书现在我想将它部署到 azure 中。我是这个 azure 主机的新手。
任何人都可以帮助我如何使用这些证书将此 webapp 部署到 azure 吗?
我尝试了以下代码。指纹是我上传到天蓝色网站的证书。
public X509Certificate2 LoadCertificate(string filename, string password)
{
X509Certificate2 cert = null;
X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
certStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certCollection = certStore.Certificates.Find(
X509FindType.FindByThumbprint,
"6B7ACC520305BFDB4F7252DAEB2177CCd091FAAE1",
false);
if (certCollection.Count > 0)
{
cert = certCollection[0];
}
if(cert == null)
{
var path = $@"{AppDomain.CurrentDomain.BaseDirectory}{filename}";
cert = new X509Certificate2(path, password);
}
return cert;
}
谢谢
Can anyone please help me how to deploy this webapp to azure with these certificates?
如果你想在CurrentUser下安装这些证书。您可以从 Azure 门户 upload the .pfx to the Azure WebApp 并添加名为 WEBSITE_LOAD_CERTIFICATES
的应用程序设置Add an app setting called WEBSITE_LOAD_CERTIFICATES and set its value to the thumbprint of the certificate. To make multiple certificates accessible, use comma-separated thumbprint values. To make all certificates accessible, set the value to *.