This Was Probably Sheer Luck ...

by Randall 7/31/2008 1:11:00 PM

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:

            <httpWebRequest useUnsafeHeaderParsing="true" />

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.

Currently rated 3.3 by 6 people

  • Currently 3.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,


Related posts


Add comment

(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]

Live preview

7/28/2015 9:16:05 PM

Powered by BlogEngine.NET
Theme by Mads Kristensen

About the author

Name of author Randall Sexton
Currently a .Net developer for Bechtel Corporation in Oak Ridge, TN.

E-mail me Send mail


<<  July 2015  >>

View posts in large calendar


    Recent comments

    Don't show



    Logo Credit

    My logo was taken from CodingHorror.
    Jeff Atwood © Copyright 2007


    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2015

    Sign in