Command 'starter.cmd "D:\home\site\d ...' was aborted due to no output nor CPU activity for 61 seconds.
You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting
(or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.
其中 IsStaging() 需與 App Service 內的 .Net 環境對應 (或移除此判斷)
正規作法
WEBSITE_LOAD_CERTIFICATES=*
大概是設定以上環境變數來允許應用程式訪問到憑證
然後憑證上傳後將指紋複製起來
到程式裡查該指紋的憑證用在原本開發憑證那邊
using System;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
string certThumbprint = "E661583E8FABEF4C0BEF694CBC41C28FB81CD870";
bool validOnly = false;
using (X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser))
{
certStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certCollection = certStore.Certificates.Find(
X509FindType.FindByThumbprint,
// Replace below with your certificate's thumbprint
certThumbprint,
validOnly);
// Get the first cert with the thumbprint
X509Certificate2 cert = certCollection.OfType<X509Certificate2>().FirstOrDefault();
if (cert is null)
throw new Exception($"Certificate with thumbprint {certThumbprint} was not found");
// Use certificate
Console.WriteLine(cert.FriendlyName);
// Consider to call Dispose() on the certificate after it's being used, available in .NET 4.6 and later
}
cert 取代下面的 x509
public override void PreConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
if (!hostingEnvironment.IsDevelopment())
{
PreConfigure<AbpIdentityServerBuilderOptions>(options =>
{
options.AddDeveloperSigningCredential = false;
});
// add custom signing credential
var x509 = new X509Certificate2(
File.ReadAllBytes("openiddict.pfx"),"222d265a-XXXX-XXXX-XXXX-5bf0f201908c");
PreConfigure<IdentityServerBuilder>(serverBuilder =>
{
serverBuilder
.AddSigningCredential(x509)
.AddValidationKey(x509);;
});
}
}