473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

The server committed an HTTP protocol violation

Does anyone have any experience with this problem. I am trying to post
about 20 fields of information to another server using
System.Net.WebClient.UploadData. This works fine for some servers but one
in particular is causing the exception "The underlying connection was
closed: The server committed an HTTP protocol violation" to be thrown.

I found a post that said to add a config file with the following....

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

When I try this, I instead get the exception "An exception occurred during a
WebClient request.". Any ideas?

Thanks,

Dan W.

Nov 23 '05 #1
1 7680
I had this problem, not with webservices or upload, but with a
HttpWebRequest , which is probably at the same layer.

One possible cause is that the server says that it does HTTP 1.1, but it
really does not. So, setting your client-side to HTTP 1.0 might avoid the
problem.
http://msdn.microsoft.com/library/en...mbersTopic.asp

BUT! How do you get access to the underlying HttpVersion from a SOAP
request? Add this code to your generated web reference file (C#):

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)
base.GetWebRequest(uri);

webRequest.KeepAlive = false;
webRequest.ProtocolVersion=HttpVersion.Version10; //
return webRequest;
}

Another possible approach is to just ignore the protocol error. Be careful,
This may or may not result in a correctly functioning app. But, In one case
I had, the protocol error was benign for my purposes.

"Dan W." <dw*******@eadmail.com> wrote in message
news:un****************@TK2MSFTNGP11.phx.gbl...
Does anyone have any experience with this problem. I am trying to post
about 20 fields of information to another server using
System.Net.WebClient.UploadData. This works fine for some servers but one
in particular is causing the exception "The underlying connection was
closed: The server committed an HTTP protocol violation" to be thrown.

I found a post that said to add a config file with the following....

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

When I try this, I instead get the exception "An exception occurred during
a
WebClient request.". Any ideas?

Thanks,

Dan W.

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Henrik | last post by:
Hi, I am trying to read some industrial webservers using the HTTP/CGI webequest like this: wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string); mwst = (HttpWebResponse wrs.GetResponse();...
0
by: Dan W. | last post by:
Does anyone have any experience with this problem. I am trying to post about 20 fields of information to another server using System.Net.WebClient.UploadData. This works fine for some servers but...
0
by: Kris Mattheus | last post by:
A little background: I've been using web services successfully for a while now. My web server is a Windows CE 4.2 device and my client is a windows C# application created with Visual Studio 2003....
3
by: Scott McDermott | last post by:
I have an application that is making an HTTP request with HttpWebRequest.GetRequest. Unless I set 'httpWebRequest useUnsafeHeaderParsing="true"' in the web.config, I get a 'The server committed a...
0
by: Vel Thavasi | last post by:
Hi, I am trying to access third party webservices and I am getting 2 different error msgs. 1) Server committed a protocol violation. 2) Content is not allowed in prolog. I searched through...
0
by: Marcus Ogden | last post by:
Hello, A client of ours using the Squid proxy server (version 2.5.STABLE6-3.4E.12.1) on Red Hat Enterprise Linux 4 is experiencing a problem when running our .NET 2.0 client application, which...
0
by: Edwardseok | last post by:
Hello All, I am making VB.NET application program to read data from other equipment. The following is my code.(VB2005.NET) ---------------code -------------------------- Private Sub...
3
by: Alon Albert | last post by:
I have an ASP.NET that has an aspx that serves a binary file for download. I need this rather than a direct link for various reasons. I am getting the following error intermitently: The server...
0
by: oriol.ardevol | last post by:
Hi, I have an asp.net application that connects through an HttpWebRequest object to a ISAPI dll in a server. This isapi dll has some different method calls. What I do is calling the different...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.