码迷,mamicode.com
首页 > 其他好文 > 详细

使用证书部署出现System.Security.Cryptography.CryptographicException 错误解决方案

时间:2016-01-26 16:32:30      阅读:1513      评论:0      收藏:0      [点我收藏+]

标签:

一、System.Security.Cryptography.CryptographicException: 找不到对象

at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx)
at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)
at HttpService.Post(String xml, String url, Boolean isUseCert, Int32 timeout)

处理方法:

IIS 应用程序池--选中你网站的所配置的应用程序池--右键 选择 “高级配置” --将“加载用户配置文件” 设置为True 。问题解决

技术分享

技术分享

二、System.Security.Cryptography.CryptographicException: 用户的配置文件是临时配置文件。

 

at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx)
at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)
at HttpService.Post(String xml, String url, Boolean isUseCert, Int32 timeout)

在IIS中选择应用程序池-属性-标识-预定义帐号-本地系统或本地服务(较安全些)

 

附:

    • LocalService -“本地服务”帐户是用户组的成员之一,它拥有与“网络服务”帐户相同的用户权限,但仅限于在本地计算机上使用。当应用程序池中的工作进程不需要访问它所运行在的 Web 服务器以外的内容时,可以使用此帐户。

    • LocalSystem -“本地系统”帐户拥有所有用户权限,它是 Web 服务器上的管理员组的成员之一。应尽可能避免使用“本地系统”帐户,因为它会给 Web 服务器带来更严重的安全风险。

    • NetworkService – Network Service 帐户是 Users 组的成员之一,并拥有运行应用程序所需的用户权限。通过使用计算机帐户的凭据,它可以在整个基于 Active Directory 的网络上进行交互。

 

使用证书部署出现System.Security.Cryptography.CryptographicException 错误解决方案

标签:

原文地址:http://www.cnblogs.com/kesimin/p/5160680.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!