Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Windows服务,请求被中止:无法使用SecurityProtocol创建SSL/TLS安全通道_C#_Json_Windows_Api_Service - Fatal编程技术网

C#Windows服务,请求被中止:无法使用SecurityProtocol创建SSL/TLS安全通道

C#Windows服务,请求被中止:无法使用SecurityProtocol创建SSL/TLS安全通道,c#,json,windows,api,service,C#,Json,Windows,Api,Service,所以我们有windows服务api,它获取数据,然后使用webclient发送到web 问题是,我们有一个发送错误的分支,而其他分支api工作正常,除了这一个发送错误的分支: “请求被中止:无法创建SSL/TLS安全通道” 我补充说 ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 但是错误仍然发生,请帮助并感谢您 我猜

所以我们有windows服务api,它获取数据,然后使用webclient发送到web 问题是,我们有一个发送错误的分支,而其他分支api工作正常,除了这一个发送错误的分支:

“请求被中止:无法创建SSL/TLS安全通道”

我补充说

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
但是错误仍然发生,请帮助并感谢您


我猜你已经追随了这里投票最多的人:

尝试像这样扩展tls协议,以便在服务器不支持以前的版本时可以回退到以前的版本:

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
               | SecurityProtocolType.Tls11
               | SecurityProtocolType.Tls12
               | SecurityProtocolType.Ssl3;

如果它仍然不能工作,请尝试用户的回答:APW和额外的故障排除步骤。

当你说“分支”时,你是指git repo中的代码分支吗?var request=webclient.uploadvalues(网站url,要传递的namevaluecollection数据)它要传递的数据web@CaiusJard我猜“分支”的意思是“路由”,“特定请求url”使用
WebClient
(见备注部分)@vasily.sib我还想知道它是否是一个像“伦敦办公室”、“纽约商店”之类的物理位置