zoukankan      html  css  js  c++  java
  • System.Security.Cryptography.RSA.FromXmlString 系统找不到指定的文件和X509读取证书文件系统找不到指定的文件异常

    前言:

        最近公司增加服务器,在新增加的服务器中发现一些问题。

        1.应用程序在读取证书文件中出现“系统找不到指定的文件。”异常,但是已经确认证书文件存在。本地测试也可以读取,就在新增加的服务器上不可以。

        2.RSA加密过程中在 System.Security.Cryptography.RSA.FromXmlString()抛异常: System.Security.Cryptography.CryptographicException: 系统找不到指定的文件。

        解决方案:

        打开IIS设置,应用程序池--》找到自己的应用程序(网站名称)-->右键-->高级设置-->在进程模型区域,有个-用户加载配置文件-选择后面为true.这个问题就解决了。

        原理:

        .NET的RSA加密会加载密钥到密钥存储区,用户加载配置文件为false时,没有密钥存储区的访问权限。所以报“系统找不到指定的文件。”异常

        本文版权归作者 心灬无痕(博文地址:http://www.cnblogs.com/xinwuhen/)所有,欢迎转载和商用,请在文章页面明显位置给出原文链接并保留此段声明,否则保留追究法律责任的权利,其他事项,可留言咨询。

        

        

        

  • 相关阅读:
    LeetCode-860. Lemonade Change
    LeetCode-455.Assign Cookies
    LeetCode-122.Best Time to Buy and Sell Stock II
    LeetCode-438.Find All Anagrams in a String
    LeetCode-50.Pow(x,n)
    LeetCode-236.Lowest Common Ancestor of a Binary Tree
    LeetCode-235.Lowest Common Ancestor of a Binary Search Tree
    LeetCode-98.Validate Binary Search Tree
    LeetCode-18.4Sum
    LeetCode-15.3Sum
  • 原文地址:https://www.cnblogs.com/xinwuhen/p/8031638.html
Copyright © 2011-2022 走看看