Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 is a valid path, if i change it i immediately get a correct .Net PathNotFound exception.

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
720 views
Welcome To Ask or Share your Answers For Others

1 Answer

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)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...