The operation has timed out when using web services
-
I am using a .net console apllication(C#) which makes API calls to a web service. There is a large amount of data transfer. The exception i am getting is "The operation has timed out". I generated stub classes from WDL files and using them in client application. Where can i set the timeout value. Is it on the client application or on the web server. and what parameters are used to set the time out value. thanks
-
I am using a .net console apllication(C#) which makes API calls to a web service. There is a large amount of data transfer. The exception i am getting is "The operation has timed out". I generated stub classes from WDL files and using them in client application. Where can i set the timeout value. Is it on the client application or on the web server. and what parameters are used to set the time out value. thanks
There are 2 types of timeouts that you can specify on the client side when making a call to a web service: send and receive. If you're expecting to send a large amount of data, increase the send timeout; if you're expecting to receive a large amount of data, increase the receive timeout. You can of course specify both or none. The timeouts are properties of the binding. Here's an example of how to specify them.
// Create service proxy
string url = "http://localhost:1234/MyService";
EndpointAddress address = new EndpointAddress (url);
WSHttpBinding binding = new WSHttpBinding();
binding.SendTimeout = ...;
binding.ReceiveTimeout = ...;
ChannelFactory cf =
new ChannelFactory(binding, address);
IMyService svcProxy = cf.CreateChannel();// Call method
svcProxy.MyMethod();Hope this helps! /ravi
This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
-
There are 2 types of timeouts that you can specify on the client side when making a call to a web service: send and receive. If you're expecting to send a large amount of data, increase the send timeout; if you're expecting to receive a large amount of data, increase the receive timeout. You can of course specify both or none. The timeouts are properties of the binding. Here's an example of how to specify them.
// Create service proxy
string url = "http://localhost:1234/MyService";
EndpointAddress address = new EndpointAddress (url);
WSHttpBinding binding = new WSHttpBinding();
binding.SendTimeout = ...;
binding.ReceiveTimeout = ...;
ChannelFactory cf =
new ChannelFactory(binding, address);
IMyService svcProxy = cf.CreateChannel();// Call method
svcProxy.MyMethod();Hope this helps! /ravi
This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
-
Thanks for the fast reply. It seems system.servicemodel is supported by only .Net framework 3.0, but i am using 2.0. so are there any equivalent methods in 2.0