異常記錄:web
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)app
The server committed a protocol violation. Section=ResponseHeader Detail='Content-Length' header value is invalidspa
今天客戶端偶然碰到了這個問題,歷來沒有發生過。.net
網上收集的資料來看,大部分的解決方案是在 web config文件 和 app config文件添加一個配置:code
<system.net> <settings> <httpWebRequest useUnsafeHeaderParsing="true" /> </settings> </system.net>
一個 Stack Overflow 的提問:server
過了一下子客戶端有一切正常了,這個問題我還搞不明白。部署
個人服務是部署在Azure雲,採用paas服務的方式部署的,具體問題有待深刻分析。get