R – Web services and Compact Framework exception handling

compact-frameworkweb services

I would like to handle such as situations as web service down. Do I use a timer or is there an exception that's being thrown when the web service is unreachable or taking too long from the client?

i am using cf 2.0 and .net 2.0 for the web service

Best Answer

If you make a call to a web service and the server is unavailable or the web service is not running on that server, a trappable exception will be thrown. You can change the Timeout property of your web service to control how long it will take before this exception is thrown (the default is 120 seconds, If I recall correctly).

Note that these two situations are different and will produce different behavior in your application. If the server itself is down, your app will wait the full 120 seconds before throwing an exception. If the server is up but the web service is not running on it, you will get the exception almost immediately (IIRC).