ASP.Net fast HTTP call

I am sending an HTTPWebRequest to a third party with the code below. The answer may take from 2 to 22 seconds. A third party claims that as soon as they receive it, they immediately send a response and that none of their other partners reports any delays (but I'm not sure I believe them, they already lied).

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.example.com");
request.Timeout = 38000;
request.Method = "POST";
request.ContentType = "text/xml";
StreamWriter streamOut = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII);
streamOut.Write(XMLToSend);     // XMLToSend is just a string that is maybe 1kb in size
streamOut.Close();
HttpWebResponse resp = null;
resp = (HttpWebResponse)request.GetResponse();      // This line takes between 2 and 22 seconds to return.
StreamReader responseReader = new StreamReader(resp.GetResponseStream(), Encoding.UTF8);
Response = responseReader.ReadToEnd();      // Response is merely a string to hold the response.

Is there any reason that the above code just ... stopped? The code works in a very reliable hosting provider (Rackspace Intensive Segment), and the machine on which it works is not used for anything else. I am just testing the code that we are going to put into production. So it’s not that the car is taxed, and given that it’s Rackspace and we pay the boat, I doubt it’s their network.

, , , 20 000 .

+3
3

, :

  • .
  • using, .
  • , .
+2

Is it possible to use the url in a normal ole browser? How fast is this happening?

Can you forward another URL (not your partner) to this code? How fast is this happening?

It is possible that you will be bitten by a “latency error” when even an instant response from your partner leads to unpredictable delays from your point of view.

Another thought: I noticed https in your URL. Is it faster with http?

+1
source

All Articles