我正在将使用.Net core 7和Angualr的Abp.io项目部署到smarterasp.net,但出现此错误
HTTP 错误 500.30 - ASP.NET Core 应用程序无法启动
我检查了日志文件,发现了这个错误
主机意外终止! Volo.Abp.AbpInitializationException:一个 模块的ConfigureServicesAsync阶段发生错误 Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule, Volo.Abp.OpenIddict.AspNetCore,版本=7.0.0.0,文化=中性, 公钥令牌=空。有关详细信息,请参阅内部异常。 ---> System.Security.Cryptography.CryptographicException:指定的 网络密码不正确。
此外,我尝试将相同的项目文件部署到本地 IIS,并且工作正常。
您能否建议解决这个问题。
我也遇到了同样的问题。
我做了以下事情:
WEB_LOAD_USER_PROFILE=1
WEB_LOAD_CERTIFICATES=*
将应用程序池设置为“启用加载用户配置文件”。
然后我创建了这个扩展方法并替换了模块中的代码以调用它并传入 System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.MachineKeySet
public static class ServerExtensions
{
public static OpenIddictServerBuilder AddProductionEncryptionAndSigningCertificateWithStorageFlag(this OpenIddictServerBuilder builder, string fileName, string passPhrase, X509KeyStorageFlags storageFlag)
{
if (!File.Exists(fileName))
{
throw new FileNotFoundException("Signing Certificate couldn't found: " + fileName);
}
X509Certificate2 certificate = new X509Certificate2(fileName, passPhrase, storageFlag);
builder.AddSigningCertificate(certificate);
builder.AddEncryptionCertificate(certificate);
return builder;
}
}