c# – 为ServicePointManager.SecurityProtocol设置每个请求值
参见英文答案 >
Set the SecurityProtocol (Ssl3 or TLS) on the .net HttpWebRequest per request6
在c#中,我可以为SSL3或TLS设置静态值,例如 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; 要么: ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; 但是(我相信)这将影响我应用程序中的所有将来的HttpWebRequest对象. 有没有办法为给定的HttpWebRequest或至少为给定的URI设置这个? 注意我已经看到这个: Uri uri = new Uri(url); ServicePoint sp = ServicePointManager.FindServicePoint(uri); 但是ServicePoint没有SecurityProtocol属性. 目前,我想我将必须在创建一个新的HttpWebRequest之前设置静态全局属性. 这不觉得正确,也意味着: >我必须确保多个线程不是在同一时间这样做. 解决方法
实现这一点已经在这里被覆盖:
How to use SSL3 instead of TLS in a particular HttpWebRequest? 和这里: Set the SecurityProtocol (Ssl3 or TLS) on the .net HttpWebRequest per request 确认我的恐惧有些用户似乎正在旋转一个单独的应用程序域来解决这个问题.我仍然认为一些线程锁定可能是可能的,如果它被定义在什么时候绑定到特定的Web请求对象的位置. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |