I just spent part of two days battling an exception while waiting on a response from a web service.
---> System.Net.WebException: The server committed a
protocol violation. Section=ResponseStatusLine at
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request)
at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest
request)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,
Object[] parameters)
I found all sorts of suggestions to fix the issue. Most of them involved adding the following information to your web.config:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
No luck.
I even found a post that suggested you override the WebRequest method within your proxy class (seems like a bad idea because if you ever regenerate your proxy class ... well, you know what'll happen to your "fix").
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(uri);
request.ProtocolVersion = HttpVersion.Version10;
return request;
}
Anyway, after neither of those solutions had worked, my Google resources were running low. I kept noticing that all of the posts mentioned .Net 1.1 ...
So I changed the webservice to use 2.0 (this is a COTS product and installs to 1.1 by default) and voila. No more nasty gram.
Perhaps this will help someone.