服务器提交了协议冲突

服务器提交了协议冲突

本文介绍了C#:HttpClient,服务器提交了协议冲突。 Section = ResponseStatusLine的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用组成,其中涉及将useUnsafeHeaderParsing属性设置为 TRUE 并设置Keep-Alive Web.Config中的 FALSE 属性。我还尝试了如下所示设置这些属性的解决方案:

This error appears to be common with a few known solutions which I have tried. They consist of this solution which involves setting the useUnsafeHeaderParsing property to TRUE and setting the Keep-Alive property to FALSE in the Web.Config. I also tried the solution of setting these properties in this manner shown below:

 ServicePointManager.DefaultConnectionLimit = 2;
 ServicePointManager.Expect100Continue = false;

这些解决方案均无效。应该注意的是,使用Http调试代理工具Fiddler捕获这些请求时,我没有收到任何错误。

None of these solutions worked. It should be noted that when using the Http Debugging proxy tool, Fiddler, to capture these requests, I don't receive any errors.

所以我要的是如果有人知道减轻此错误的好方法,那么我可以在一个连接中发出多个请求而不会丢失更新主体。如果需要更多详细信息,我很乐意提供。

So what I am asking for is if anyone knows a good solution to alleviate this error so I can make multiple requests in a connection without losing the body of an update. If more details are needed, I am happy to supply them.

推荐答案

基本问题是PATCH响应中包含内容。响应的主体。发送204无内容时,请确保服务器未发送内容。

The underlying problem is that the PATCH response includes content within the body of the response. Ensure that the server does not send content when sending a 204 No Content.

这篇关于C#:HttpClient,服务器提交了协议冲突。 Section = ResponseStatusLine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 06:47