转 留记录。我是第二个错误原因

我总结了一下出现证书无法加载的原因有以下三个

1.证书密码不正确,微信证书密码就是商户号

解决办法:请检查证书密码是不是和商户号一致

2.IIS设置错误,未加载用户配置文件

解决办法:找到网站使用的应用程序池-->右击-->高级设置-->打开如下图-->在加载用户配置文件选择true

3.如果以上两个方案都不能解决问题,就有可能是加载证书时没有给定证书存储标识

解决方法:在加载证书方法时使用以下方法,请注意第三个参数

X509Certificate2 cer = new X509Certificate2(cerPath, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorage

System.Security.Cryptography.CryptographicException 微信支付中公众号发红包时候碰到的错误。的更多相关文章

  1. .NET Core之微信支付之公众号、H5支付篇

    前言 本篇主要记录微信支付中公众号及H5支付全过程. 准备篇 公众号或者服务号(并开通微信支付功能).商户平台中开通JSAPI支付.H5支付. 配置篇 公众号或者服务号中 -------开发----- ...

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

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

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

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

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

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

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

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

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

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

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

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

  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. C#记录程序运行时间

    主要:using System.Diagnostics;当中有Stopwatch类: 介绍如下: // 摘要: // 提供一组方法和属性,可用于准确地测量运行时间. public class Stop ...

  2. google earth 中的飞行模拟器的键盘控制

  3. Hexo 最常用的几个命令

    Hexo 约有二十个命令,但普通用户经常使用的大概只有下列几个: hexo s hexo s 启动本地服务器,用于预览主题.默认地址: http://localhost:4000/ hexo s 是  ...

  4. C++ 内敛函数

    在主调函数调用函数时,先将现场压入栈以保存现场-转去执行被掉函数-返回主调函数.现场出栈以恢复现场-继续往下执行. 为了减少函数调用的成本,特别是对于小型函数,C++提供了内敛函数(inline).C ...

  5. log4net 入门使用

    log4net 是dotnet平台下的一个日记记录组件. 一  NuGet中安装log4net包: 二 配置log4net.config文件 配置文件内容: <?xml version=&quo ...

  6. Android-Activity-startActivityForResult

    之前 Android-Intent意图传递数据,的博客讲解了,一个Activity 跳转 到另外一个Activity 可以把数据带过去 Android还提供了一种方式,一个Activity 跳转 到另 ...

  7. [LeetCode 题解]: Remove Duplicates from Sorted List

    Given a sorted linked list, delete all duplicates such that each element appear only once. For examp ...

  8. SQLite Mysql 模糊查找(like)

    select UserId,UserName,Name,Sex,Birthday,Height,Weight,Role from xqhit_Users where UserName like &qu ...

  9. ODBC方式操作oracle数据库

    ODBC方式操作oracle数据库 一.查询语句: var strConn = System.Configuration.ConfigurationManager.ConnectionStrings[ ...

  10. nginx location 与 rewrite详解 (转)

    点我