Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.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
webclient的.NET(c#)实现与java或firefox RESTClient有什么不同?_C#_.net_Http_Visual Studio 2012 - Fatal编程技术网

webclient的.NET(c#)实现与java或firefox RESTClient有什么不同?

webclient的.NET(c#)实现与java或firefox RESTClient有什么不同?,c#,.net,http,visual-studio-2012,C#,.net,Http,Visual Studio 2012,我需要使用c#将JSON发布到https端点 我正在使用System.Net.WebClient(或HttpWebRequest) 当我使用JAVA或firefox RESTClient将JSON发布到端点时,一切正常(从同一台机器) 通过Wireshark,我可以看到接收服务器重置了连接,导致.NET异常: Unable to read data from the transport connection: An existing connection was forcibly closed

我需要使用c#将JSON发布到https端点

我正在使用System.Net.WebClient(或HttpWebRequest)

当我使用JAVA或firefox RESTClient将JSON发布到端点时,一切正常(从同一台机器)

通过Wireshark,我可以看到接收服务器重置了连接,导致.NET异常:

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
我不使用任何代理服务器。 我已经将请求超时设置为-1(以及其他值)

.NET运行时可以向firefox Resten JAVA没有的请求添加(或删除)什么

一定有区别。
Fiddler向我显示了两个响应状态为200的http(s)请求,但似乎没有返回任何数据(Fiddler引入了代理…)

@Mason感谢您让我再次查看Fiddler数据

将协议设置为TLS1.2后

ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls12

它起作用了。 我看到过一些帖子,它们实际收到了一条错误消息,暗示TLS支持程度最低。但在这里,我必须先通过StackOverflow。
仅仅是制定问题的练习和第一个快速响应者就可以帮助我快速解决这个问题

看看Fiddler中的请求,看看你能发现什么不同?@Edbayates我没有否决投票,也没有关闭投票,但我能看出这个问题有什么错:这是无数关于
连接被远程主机强制关闭的问题的重复,如果你能发一个指向示例dup的链接的话?当前的投票结果并不表明这是一个dup。@EdBayiates@mpjjonker Copy将您的测试和试用粘贴到[Update]部分。