asp.net-core - HTTP 错误 500.30(Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The system cannot find the file specified.)

标签 asp.net-core iis

我正在尝试将 asp.net 核心 Web API 部署到 IIS。这个应用程序在 Visual Studio 上运行得非常好,当我使用 dotnet 命令运行 dll 时也是如此。此应用程序具有用于签署 JWT token 的证书。将应用程序部署到 IIS 后,我收到“HTTP 错误 500.30 - ANCM 进程内启动失败”,我检查了 Windows 日志,错误消息是
主机意外终止。
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: 系统找不到指定的文件。在 Internal.Cryptography.Pal.CertificatePal.FilterPFXStore(Byte[] rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)......
我检查了文件路径和文件名一切都正确,但由于某些原因 IIS 无法加载找到证书文件。另外,我检查了许可,它看起来也不错。不知道为什么我收到此错误消息
此外,我使用 IIS 指向的 dotnet run 命令运行了相同的应用程序 dll 文件,但我没有收到任何错误。我只有在部署到 IIS 后才会收到此错误。
在 startup.cs 文件和配置方法上,我在这一行遇到错误。

var cert = new X509Certificate2("test_cert.pfx", pwdFrmVault);

最佳答案

我在搜索此错误并使用谷歌搜索后,此解决方案对我有用。 IIS管理器->应用程序池->高级设置->在进程模型下,将用户配置文件加载为true。更多详情请见 link

关于asp.net-core - HTTP 错误 500.30(Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The system cannot find the file specified.),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63043562/

相关文章:

c# - 如何减少 ASP.NET Core 中的 cookie 大小(类似于使用引用模式)?

c# - 使用 Entity Framework Core 调用标量函数的最佳实践 (2.1)

iis - 无法从 IIS :\in powershell 运行 'dir' 或 'Get-ChildItem"命令

iis - VS2017/Angular 7升级部署错误(开发模式)

asp.net - 共享2个应用程序: Session State Deserialization Error for ASP.Net MVC

c# - 如何在 JavaScript 中制作上传进度的上传小部件,将文件发布到 IIS 服务器?

C# MVC/API - 从 Amazon S3 为我的 API 调用返回图像

asp.net-core - Asp.net Core EF options.UseInMemoryDatabase System.TypeLoadException

c# - Asp.Net Core WEB API调用方法报错404

javascript - JS : XMLHttpRequest only works on specific file extensions?