【问题标题】:ASP.NET MVC: “An internal error occurred.” when loading certificate bytes with X509Certificate2ASP.NET MVC:“发生内部错误。”使用 X509Certificate2 加载证书字节时
【发布时间】:2011-08-31 03:24:06
【问题描述】:

我已经花了几个小时来解决这个错误。奇怪的是,当我独立使用this 库时,它工作得非常好,但是当我将它们与我的 ASP .NET MVC 网站集成时,它开始抛出以下异常。我还根据建议 here 使用了 MachineKeySet 标志,但仍然没有运气。谁能帮我摆脱这个例外。谢谢。

发生内部错误。

描述:未处理的异常 在执行过程中发生 当前的网络请求。请查看 堆栈跟踪以获取有关的更多信息 错误及其起源 代码。

异常详情: System.Security.Cryptography.CryptographicException: 发生内部错误。

来源错误:

第 194 行:如果 (string.IsNullOrEmpty(p12FilePassword)) 第 196 行:证书 = new X509Certificate2(p12FileBytes, "", X509KeyStorageFlags.MachineKeySet); 第 197 行:否则

【问题讨论】:

    标签: exception asp.net-mvc-3 x509certificate2


    【解决方案1】:

    我找到了解决方案here。看起来像一个已知问题。我一起使用了X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable 标志,问题就消失了。其他解决方案是将 applicationpool 的标识更改为 LOCALSERVICE。

    【讨论】:

      猜你喜欢
      • 2010-11-23
      • 2017-11-14
      • 2021-12-07
      • 2015-12-28
      • 1970-01-01
      • 2017-09-02
      • 2016-07-12
      • 2018-05-02
      • 1970-01-01
      相关资源
      最近更新 更多