在Windows 7中运行应用程序的证书问题 [英] Certificate issues running app in Windows 7
问题描述
我在使用我的应用程式时遇到问题。我使用'org.mentalis.security'程序集从'pfx'文件创建证书对象,这是发生异常的代码行:
证书cert = Certificate.CreateFromPfxFile(publicKey,certificatePassword);
,但由于某种原因,当在Windows 7中运行时(在2台机器上尝试),它会抛出异常。
CertificateException:
Unable导入PFX文件! [错误代码= -2146893792]
我通过Google找不到这条消息,但在检查事件查看器时,审核失败:
事件ID = 5061
源= Microsoft Windows安全
任务类别=系统完整性
关键字=审计失败
加密操作。
主题:
安全ID:NT AUTHORITY\IUSR
帐户名称:IUSR
帐户域:NT AUTHORITY
登录ID:0x3e3
密码参数:
提供程序名称:Microsoft软件密钥存储提供程序
**算法名称:不可用**
密钥名称:VriendelijkeNaam
密钥类型:用户键。
< BR>
加密操作:
操作:打开密钥。
返回代码:0x2
我不知道为什么这不工作7,当我在Vista上运行时,我从来没有遇到过问题。我以管理员身份运行VS2008,但我猜想,也许ASP.NET用户没有足够的权限或任何东西。
很奇怪,算法名称
任何人都可以帮我解决这个问题。
p>
您好
我解决了这个问题,请前往c:\windows \system32 \\ \\ inetsrv或syswow64 \inetsrv
并运行以下命令
appcmd set apppool name]-processModel.loadUserProfile:true
这解决了它
Richard Allen
I'm having some problems with my app. I'm using the 'org.mentalis.security' assembly to create a certificate object from a 'pfx' file, this is the line of code where the exception occurs:
Certificate cert = Certificate.CreateFromPfxFile(publicKey, certificatePassword);
This has always worked and still does in production, but for some reason it throws an exception when run in Windows 7 (tried it on 2 machines).
CertificateException :
Unable to import the PFX file! [error code = -2146893792]
I can't find much on this message via Google, but when checking Event Viewer I get an 'Audit Failure' every time this exception occurs:
Event ID = 5061
Source = Microsoft Windows Security
Task Category = system Integrity
Keywords = Audit Failure
Cryptographic operation.
Subject:
Security ID: NT AUTHORITY\IUSR
Account Name: IUSR
Account Domain: NT AUTHORITY
Logon ID: 0x3e3
Cryptographic Parameters:
Provider Name: Microsoft Software Key Storage Provider
**Algorithm Name: Not Available.**
Key Name: VriendelijkeNaam
Key Type: User key.
<BR>
Cryptographic Operation:
Operation: Open Key.
Return Code: 0x2
I'm not sure why this isn't working on Win 7, I've never had problems when I was running on Vista with this. I am running VS2008 as administrator but I guess that maybe the ASP.NET user doesn't have sufficient rights or something.
It's pretty strange that the 'Algorithm name' is 'Not Available'.
Can anyone help me with this?
Sorry Corrected
Hi
I solved this by going to c:\windows\system32\inetsrv or syswow64\inetsrv
and running the following command
appcmd set apppool "[you app pool name]" -processModel.loadUserProfile:true
This solved it
Richard Allen
这篇关于在Windows 7中运行应用程序的证书问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!