在 Windows 7 中运行应用程序的证书问题

Certificate issues running app in Windows 7(在 Windows 7 中运行应用程序的证书问题)
本文介绍了在 Windows 7 中运行应用程序的证书问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 AUTHORITYIUSR
 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:windowssystem32inetsrv or syswow64inetsrv

and running the following command

appcmd set apppool "[you app pool name]" -processModel.loadUserProfile:true

This solved it

Richard Allen

这篇关于在 Windows 7 中运行应用程序的证书问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

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

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)