X509Certificate2 使 IIS 崩溃

X509Certificate2 makes IIS crash(X509Certificate2 使 IIS 崩溃)
本文介绍了X509Certificate2 使 IIS 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当更新 X509Certificate2(string, string) 的实例时,我的 IIS 进程简单地崩溃了.没有 .Net 异常,什么都没有,除了我的事件日志中的这个

When newing up an instance of X509Certificate2(string, string) my IIS process simply crashes. No .Net exception, no nothing, except of this in my event log

Faulting application name: w3wp.exe, version: 8.0.9200.16384, time stamp: 0x50108835
Faulting module name: ntdll.dll, version: 6.2.9200.16420, time stamp: 0x505ab405
Exception code: 0xc0000374
Fault offset: 0x00000000000ea485
Faulting process id: 0x102c
Faulting application start time: 0x01ce10301e250c4d
Faulting application path: c:windowssystem32inetsrvw3wp.exe
Faulting module path: C:WindowsSYSTEM32
tdll.dll
Report Id: 5e55321c-7c23-11e2-93f9-00155d8a0f17
Faulting package full name: 

我很震惊,不知道从哪里开始寻找.将调试器附加到进程时,我可以中断这一行,但是当跨过它时,整个事情都会崩溃.

Im pretty stunned and don't know where to start looking. When attaching a debugger to the process, i'm able to break unto this line, but when stepping over it the the whole thing crashes.

_certificate = new X509Certificate2(pfxFile, pfxPassword);

pfxFile 是一个有效路径,如果我更改它,我会立即得到一个正确的 .Net PathNotFound 异常.

pfxFile is a valid path, if i change it i immediately get a correct .Net PathNotFound exception.

服务器是 Windows 2012,运行 IIS8 和 .Net 4.5.

Server is Windows 2012, running IIS8 and .Net 4.5.

更新
这篇文章描述了同样的问题,解决方案是确保应用池身份启用了 LoadUserProfile.

Update
This article describes the same problem where a solution is to make sure the App Pool identity has LoadUserProfile enabled.

推荐答案

我也遇到过类似的问题,也是在 Windows Server 2012 上,使用时 IIS 崩溃

I had a similar problem, also on Windows Server 2012, which crashed IIS, when using

new X509Certificate2(fileName, keyPassword, X509KeyStorageFlags.Exportable)

已通过将构造函数更改为

This was fixed by changing the constructor to

new X509Certificate2(fileName, keyPassword, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable)

这篇关于X509Certificate2 使 IIS 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)