473,804 Members | 3,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request has timed

Hi all

I have the following piece of code for retrieving some info from an
external url. I receive an error - "The operation has timed-out" at
GetResponse() line. I have tried extending the time out duration. I
dont have any SETI etc on my computer. Anything wrong in code? how can
i resolve my issue?

Any insight highly appreciated..
thanks
laks..
------------------------------------------
strXmlRequest = "Something in xml";

XmlDocument xmlDoc;
xmlDoc = new XmlDocument();
xmlDoc.LoadXml( strXmlRequest);

// Create an HTTP request to do a POST
System.Net.Http WebRequest xmlHttpRequest = (HttpWebRequest )
WebRequest.Crea te("http://www.somesite.co m/ExtInterface/ListingSearch.a sp");
xmlHttpRequest. Method="POST";

// Write the serialized XML to the request.
XmlTextWriter xmlWriter = new
XmlTextWriter(x mlHttpRequest.G etRequestStream (),
Encoding.GetEnc oding("UTF-8"));
xmlDoc.WriteTo( xmlWriter);

// Force the XML text writer to finish
xmlWriter.Flush ();

// Get the response from the server
System.Net.Http WebResponse xmlHttpResponse = (HttpWebRespons e)
xmlHttpRequest. GetResponse();

// Parse the response into a new XmlDocument and return it.
XmlDocument respDoc = new XmlDocument();
respDoc.Load(xm lHttpResponse.G etResponseStrea m());
xmlHttpResponse .Close();
------------------------------------------------

Nov 19 '05 #1
2 1628
Have you verified that the external site you are going to actually returns a
page?

I would first simplify the code:

1) Create Request
2) Open
3) Response.Write( result)

You can through come try/catches also in there around the Get, then walk
through the code in debug so you can look closer at the Exceptions that are
thrown.


"laks" <al********@yah oo.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi all

I have the following piece of code for retrieving some info from an
external url. I receive an error - "The operation has timed-out" at
GetResponse() line. I have tried extending the time out duration. I
dont have any SETI etc on my computer. Anything wrong in code? how can
i resolve my issue?

Any insight highly appreciated..
thanks
laks..
------------------------------------------
strXmlRequest = "Something in xml";

XmlDocument xmlDoc;
xmlDoc = new XmlDocument();
xmlDoc.LoadXml( strXmlRequest);

// Create an HTTP request to do a POST
System.Net.Http WebRequest xmlHttpRequest = (HttpWebRequest )
WebRequest.Crea te("http://www.somesite.co m/ExtInterface/ListingSearch.a sp"); xmlHttpRequest. Method="POST";

// Write the serialized XML to the request.
XmlTextWriter xmlWriter = new
XmlTextWriter(x mlHttpRequest.G etRequestStream (),
Encoding.GetEnc oding("UTF-8"));
xmlDoc.WriteTo( xmlWriter);

// Force the XML text writer to finish
xmlWriter.Flush ();

// Get the response from the server
System.Net.Http WebResponse xmlHttpResponse = (HttpWebRespons e)
xmlHttpRequest. GetResponse();

// Parse the response into a new XmlDocument and return it.
XmlDocument respDoc = new XmlDocument();
respDoc.Load(xm lHttpResponse.G etResponseStrea m());
xmlHttpResponse .Close();
------------------------------------------------

Nov 19 '05 #2
Insert line xmlWriter.Close () after xmlWriter.Flush (); and it works
fine.

Nov 19 '05 #3

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

Similar topics

0
12443
by: Steve | last post by:
Hi All, I keep getting the "System.Web.HttpException: Request timed out." error message when I was uploading image files (about 400 image files) to SQL table, all those image files are FTP to web server first, then my aspx page reads those image files from web server then uploads to SQL table (SQL server is in same machine as Web server), I have done following: set SQL connection timeout to 6000 (in web.config file), set SQL command...
2
7868
by: William F. Robertson, Jr. | last post by:
Some of my users are receiving an error: Server Error in '/' Application. ---------------------------------------------------------------------------- ---- Request timed out. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
0
3840
by: Jack Wright | last post by:
Dear All, I have a web Application "http://localhost/Web/WebForm1.aspx" that calls a WebService from "http://localhost/webserviceapp/service1.asmx"...I have set the executionTimeout to 10 secs in Web.Config where my WebService is installed. <httpRuntime executionTimeout="10" appRequestQueueLimit="2" /> When I call a method "TestPlan" which takes more than 10 secs my web Page gets the following error:
5
2426
by: Jack Wright | last post by:
Dear All, I have a web Application "http://localhost/Web/WebForm1.aspx" that calls a WebService from "http://localhost/webserviceapp/service1.asmx"...I have set the executionTimeout to 10 secs in Web.Config where my WebService is installed. <httpRuntime executionTimeout="10" appRequestQueueLimit="2" /> When I call a method "TestPlan" which takes more than 10 secs my web Page gets the following error:
1
4139
by: Saumin | last post by:
I have an aspx page, which ususally takes 7-10 mins to execute. So, I set executionTimeout=600 under httpRuntime tag in my web.config. But after 3 minutes, it fails with the error message of "System.Web.HttpException: Request timed out". The aspx is calling a .NET component which is doing different tasks. Here is what i have in my web.config. <system.web> <httpRuntime executionTimeout="600" maxRequestLength="512000" />
3
17822
by: nms | last post by:
I've an ASP.net web site, Since last some days, Users are experiencing problem when they try to generate reports (for a large date range) it says, Request timed out. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
1
36717
by: SenthilPSL | last post by:
When I call a webservice on IIS on Windows 2000 Server with .NET runtime 2.0, I get the following Error. System.Net.WebException: The operation has timed out From ASPX Pages, I call the web service, which in turn calls dlls for executing the sotred procedure. SP runs for about 10 mins. (It has to; because the application demands running such big SP in synchronous mode). I have set the execution timeout to 1 hour both in website (for ASPX)...
1
4544
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
We have hosted a web application in a client network and the application is responding very slow. In between we are getting exceptions due to the request time out. We are getting the following exceptions: 1. Event Message : Request has been aborted. Exception Type : HttpException Exception Message : Request timed out
1
1830
by: WestG | last post by:
I am not able to save, as it is giving the request timed out error in my application: When i click on Save button in my application it gives me request timed out error. Till now the finding is, it gives problem when trying to access text from rich text box. It starts eating CPU while accessing value from textbox. Type : System.Threading.ThreadAbortException, Message : Thread was being aborted. Source : System
0
9707
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
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 we have to send another system

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.