一、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 错误解决方案的更多相关文章

  1. 部署时,出现用户代码未处理 System.Security.Cryptography.CryptographicException 错误解决方法

    转载:http://www.cnblogs.com/jys509/p/4499978.html 在调用RSA加密的.pfx密钥时,在本地调试没有问题,可以布署到服务器,就会报以下的错误: 用户代码未处 ...

  2. 调用微信退款接口时,证书验证出现System.Security.Cryptography.CryptographicException: 出现了内部错误 解决办法

    1.证书密码不正确,微信证书密码就是商户号 解决办法:请检查证书密码是不是和商户号一致 2.IIS设置错误,未加载用户配置文件 解决办法:找到网站使用的应用程序池-->右击-->高级设置- ...

  3. X509证书 指定了无效的提供程序类型 System.Security.Cryptography.CryptographicException 错误解决方法

    第一种解决办法: IIS 应用程序池--选中你网站的所配置的应用程序池--右键 选择 “高级配置” --将“加载用户配置文件” 设置为True 第二种解决办法: 在加载证书方法时使用以下方法,请注意第 ...

  4. System.Security.Cryptography.CryptographicException 出现了内部错误

    调试微信支付退款时,需要使用pfx证书,在本地调试时没有问题,但在服务器部署时报异常:System.Security.Cryptography.CryptographicException 出现了内部 ...

  5. WCF:System.Security.Cryptography.CryptographicException: 密钥集不存在

    WCF使用IIS部署时,使用x509证书验证,在创建证书并正确配置程序后,访问出现错误提示: System.Security.Cryptography.CryptographicException: ...

  6. System.Security.Cryptography.CryptographicException: 指定了无效的提供程序类型

    这两天在调用银联在线的支付接口,把银联提供的demo代码copy过来放到自己网站上,生成通过了,但是运行的时候就报错了: 指定了无效的提供程序类型. 说明: 执行当前 Web 请求期间,出现未经处理的 ...

  7. "System.Security.Cryptography.CryptographicException: 拒绝访问" 问题的解决方法

    .net web程序使用rsa算法进行加解密时,程序报告“System.Security.Cryptography.CryptographicException: 拒绝访问”错.按网上搜的解决方法做了 ...

  8. WebApi 数据保护操作未成功。这可能是由于未为当前线程的用户上下文加载用户配置文件导致的。当线程执行模拟时,可能会出现此情况。","ExceptionType":"System.Security.Cryptography.CryptographicException","StackTrace

    在调用System.Security.Cryptography.ProtectedData.Protect方法来保护私密信息时,IIS可能会报以下错误:CryptographicException: ...

  9. System.Security.Cryptography.CryptographicException

    在调用System.Security.Cryptography.ProtectedData.Protect方法来保护私密信息时,IIS可能会报以下错误:CryptographicException: ...

随机推荐

  1. CentOS下安装vsftpd架设ftp服务器

    什么是vsftpd vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序.特点是小巧轻快,安全易用. 首先安装vsftpd这个软件,命令是,yum install vsftpd servi ...

  2. javascript 网页图标音乐切换

    图片名称 sprite.zip <!doctype html> <html> <head> </head> <style> .css{ po ...

  3. CSS3 Transitions

    浏览器支持 属性 浏览器 transition Internet Explorer不支持过渡属性. Firefox4需要前缀-moz-. Chrome和Safari需要前缀-webkit-. Oper ...

  4. 使用telnet操作memcache,一般不常用

    使用telnet操作memcache,一般不常用   1.使用方法 1. 连接到memcached telnet 192.168.1.100 11211 add name 0 60 5     [说明 ...

  5. 不在界面上用控件 动态创建idhttp,IdAntiFreeze来用

    不在界面上用控件 动态创建idhttp,IdAntiFreeze来用 var IdHTTP: Tidhttp; IdAntiFreeze: TidAntiFreeze; begin IdAntiFre ...

  6. 文件头 MAGE_FILE_HEADER

    IMAGE_FILE_HEADER这个结构的定义如下: typedef struct _IMAGE_FILE_HEADER { 00h WORD Machine; //运行平台 02h WORD Nu ...

  7. asp.net2.0app开发。

    asp.net app 网站开发:http://www.cnblogs.com/TerryFeng/archive/2009/05/15/1457731.html 在OPERA或M3GATE中设置编码 ...

  8. 转:CString::GetLength()获得字节数的正确方法

    前段时间,做http协议上传文件及断点续传控件时,在客户端采用C++调用CHttpConnection.CHttpFile进行文件上传.移植到Unicode编码时,上传得到的文件总是小于正常文件.最终 ...

  9. MySQL原生HA方案 – Fabric体验之旅

    http://www.csdn.net/article/2014-08-20/2821300

  10. CreateFile FileSeek FileRead 直接读取数据

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...