Hello Pooja,
I hope the following suggestions would be helpful to you.
Timeout is the property which is related to the synchronous calls to the
webservice methods. No matter how long you set the timeout for method call,
the client may sometimes fail to receive the response in the stipulated time
limits.
I would rather suggest you to call the web method Asynchronously.
Here i assume that you know how to call the methods asynchronous.
Below are some examples.
*****
private void Button1_Click(object sender, EventArgs e)
{
// Synchronous call to webservice method.
Service.Service objService = new
TestInfragistics.Service.Service();
objService.Timeout = 1000000;
MessageBox.Show(objService.HelloWorld().ToString() );
MessageBox.Show(objService.Hello("Smith").ToString ());
objService.Dispose();
// Asynchronous call to webservice method.
Service.Service objService1 = new
TestInfragistics.Service.Service();
objService1.HelloCompleted += new
HelloCompletedEventHandler(objService1_HelloComple ted);
objService1.HelloAsync("Smith");
objService1.Dispose();
// Asynchronous call - 2 to webservice method.
Service.Service objService2 = new
TestInfragistics.Service.Service();
objService2.HelloWorldCompleted += new
HelloWorldCompletedEventHandler(objService2_HelloW orldCompleted);
objService2.HelloWorldAsync();
objService2.Dispose();
}
void objService2_HelloWorldCompleted(object sender,
HelloWorldCompletedEventArgs e)
{
if (e.Result != null)
MessageBox.Show(e.Result.ToString());
}
void objService1_HelloCompleted(object sender,
HelloCompletedEventArgs e)
{
if (e.Result != null)
MessageBox.Show(e.Result.ToString());
}
*****
Hope this would solve your problem.
Jay Kudecha.
"Pooja" wrote:
Hi,
I am calling a web service to get Latitude and Longitude by sending a zip
code. This is happening inside a loop (2000 - 3000 times). After say 80
times, it gives me an error - The operation has timed out. If I continue by
pressing F10, the process starts again and everything is fine. After some
time again it will stop, show me an error on the line where I am calling
webservice and if i say F10, it will again continue.
I wanted to know how can I stop this "The operation has timed out" error
from coming. I have also set the Time Out property of web service to a large
value (1000000 ms), but still it doesn't help. I'm using .Net 2.0
Thanks,
Pooja.