Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

http response status error

Status
Not open for further replies.

dubBeat

Programmer
Apr 2, 2007
21
IE
Hi,

for the past while ive been stuck with the following

error when i debug my application

"The server committed a protocol violation.

Section=ResponseStatusLine"

My application is sends 2 requests to a java servlet.

The first request works fine.

If I try to send any other request the error occurs.

Ive looked around online about the error.

I tried setting <httpWebRequest

useUnsafeHeaderParsing="true" /> in the web config file

but it does not work.

Also I read that the iis server has problems if another

application is using port 80.

The servlet is configured to run on port 80 so I changed

it to port 81.

I still get the error.

For a while I thought the problem was with session cookies but after investigation this turned out not to be the case.

I nearly certain that the problem does not lay in my code either.

Im really baffled as to why this error is occuring.

Any help or insight would be greatly appreciated.

Thanks

Dub

/////Request 1

string url = " string result = string.Empty;
string postData = "msisdn0=862324984";
Uri uri = new Uri(url);
HttpWebRequest request =

(HttpWebRequest)WebRequest.Create(uri + "demo1_res");

request.Method = "POST";
request.ContentType =

"application/x- request.ContentLength = postData.Length;
// request.Referer =

" request.ProtocolVersion =

HttpVersion.Version11;
Stream writeStream =

request.GetRequestStream();
UTF8Encoding encoding = new UTF8Encoding();
byte[] bytes = encoding.GetBytes(postData);
writeStream.Write(bytes, 0, bytes.Length);
HttpWebResponse response =

(HttpWebResponse)request.GetResponse();



Stream responseStream =

response.GetResponseStream();
StreamReader readStream = new

StreamReader(responseStream);
result = readStream.ReadToEnd();
////////////////////////////////////
/////Request 1
 
I havnt no.

A search on "disposing objects" might lead me in the right direction?
 
Hi,

I read in a post that if I declare connection objects
like this using "using" that the objects are automattically disposed of.

Is this true?

I changed my code to use "using" but the problem remains.

Do you know of a way to check if an object has been destroyed?

using (HttpWebResponse responseFromCrk = (HttpWebResponse)requestToCrk.GetResponse())
using (StreamReader sr = new StreamReader(responseFromCrk.GetResponseStream()))

{
string responseBody = sr.ReadToEnd();
responseFromCrk.Close();
sr.Close();
}

Just to clarify, do you suspect that the second response is attempting to use resources which are still held by the first response?

Thanks again

-Dub
 
Sorry just one other question.

I'm really at my wits end with this and have been pretty much trying anything that i come across.

Do you think it might be useful in any way to use a service point?

I think my main problem is not really understanding what the problem is exactly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top