异常:The server committed a protocol violation

Posted easeyeah

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了异常:The server committed a protocol violation相关的知识,希望对你有一定的参考价值。

 

异常记录:

Exception rethrown at [0]:
在 Wintop.Windows.FrmLogin.btnLogin_Click(Object sender, EventArgs e)
2017-07-10 17:08:29.8774 ERROR 登陆出错 System.ServiceModel.CommunicationException: 服务器提交了协议冲突. Section=ResponseHeader Detail=“Content-Length”标题值无效 ---> System.Net.WebException: 服务器提交了协议冲突. Section=ResponseHeader Detail=“Content-Length”标题值无效
在 System.Net.HttpWebRequest.GetResponse()
在 System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- 内部异常堆栈跟踪的结尾 ---

Server stack trace:
在 System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
在 System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
在 System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

 

 

The server committed a protocol violation. Section=ResponseHeader Detail=\'Content-Length\' header value is invalid

今天客户端偶然碰到了这个问题,从来没有发生过。

网上收集的资料来看,大部分的解决方案是在 web config文件 和 app config文件添加一个配置:

<system.net> 
  <settings> 
   <httpWebRequest useUnsafeHeaderParsing="true" /> 
  </settings> 
</system.net> 

 

一个 Stack Overflow 的提问:

https://stackoverflow.com/questions/2482715/the-server-committed-a-protocol-violation-section-responsestatusline-error 

 

过了一会儿客户端有一切正常了,这个问题我还搞不明白。

我的服务是部署在Azure云,采用paas服务的方式部署的,具体问题有待深入分析。

 

以上是关于异常:The server committed a protocol violation的主要内容,如果未能解决你的问题,请参考以下文章

Tomcat异常:The Tomcat server configuration atServersTomcat v9.0 Server at localhost-c

eclipse Run On Server 异常:could not load the Tomcat Server configuration at Servers\tomcat V5.0 Serto

C#中 打开Docx文件报错 The associated COM server does not support ActiveX Document embedding

FlinkFlink 写入 kafka 报错 The server disconnected before a response was received

异常Zipkin server java.lang.IllegalArgumentException: Prometheus requires that all meters with the s

内部异常:java.sql.SQLException:事务无法继续STATUS_COMMITTED