Solve the WebService/WCF call error "protocol conflict. Section = ResponseStatusLine submitted by the server", wcfwebservice
Today, I updated a website, added a page, and called WebService. After the test environment is complete and deployed to the official environment, an error is returned:
The server submitted a protocol conflict. Section = ResponseStatusLine
I checked a lot of solutions on the Internet and added the configuration section:
<system.net> <settings>
However, there is no such thing!
By chance, I found the real cause.
I am continuously debugging in the development environment. I opened a new Session for IE and found that WebService cannot be accessed directly and is blocked by the proxy. WTF! Turn off the proxy. Now it is ready.
I used output. config generated by svcutil to embed it into my web. config. The ServiceModel in it is as follows:
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="xxx" closeTimeout="00:01:00" ... useDefaultWebProxy="true"> ...
That is, useDefaultWebProxy = "true" enables him to automatically use the proxy. We can see what proxy is definitely set on the server, because this ws is accessed through a firewall policy across network segments, so it is automatically included in the proxy white list, however, the proxy cannot actually access this CIDR block, so the returned information is actually blocked by the Proxy:
<Html><Body><H1> 10.xx.xx.xx is prohibited by proxy.</H1></Body></Html>
It is no wonder that parsing errors have been delayed for a lot of time.
Both WebService and WCF will encounter similar problems. Write down to avoid forgetting.