【问题标题】:how to set ServicePointManager.ServerCertificateValidationCallback in web.config如何在 web.config 中设置 ServicePointManager.ServerCertificateValidationCallback
【发布时间】:2015-01-30 08:06:42
【问题描述】:

如何在 web.config 文件中进行设置

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) =>true;

【问题讨论】:

    标签: c#


    【解决方案1】:

    试试这个;

    Global.asaxApplication_Start 中编写您的代码。

    它应该工作..!!!

    在配置文件中;

    <configuration>
     <system.net>
       <settings>
         <servicePointManager
            checkCertificateName="false"
            checkCertificateRevocationList="false"         
         />
      </settings>
    </system.net>
    </configuration> 
    

    您也可以访问MSDN

    【讨论】:

    • 但是这个返回错误只允许一个 元素。它必须是根 元素 @H.Mahida 的第一个子元素
    • 如果您使用的是 ,则 元素必须位于 下方,尽管误导性错误说明了什么。
    猜你喜欢
    • 1970-01-01
    • 2013-10-14
    • 1970-01-01
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    • 2011-05-20
    • 2012-10-10
    • 2012-09-07
    相关资源
    最近更新 更多