473,473 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 7689
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
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
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.