C#解决System.Security.Cryptography.MD5.Create()调用的目标发生了异常)的问题

今天搭建微信扫码支付环境的时候,一样的配置参数,调用连接提示错误

错误:调用的目标发生了异常

然后跟踪到执行

 MD5 md5 = System.Security.Cryptography.MD5.Create();

代码报错,使用度娘搜索无果。后面从谷歌搜索英文错误得以解决

解决办法:

add the following configuration to your application configuration file and see if it works fine for you.

加入下面的配置到你的应用程序配置文件,然后在看是否有效。

<configuration>
    <runtime>
       <enforceFIPSPolicy enabled="false"/>
    </runtime>
</configuration>

笔者加入到app.config文件后,得到解决

原文地址:https://www.cnblogs.com/weifeng123/p/7954172.html