C# – Web-services calls locks up when network connection lost

ccompact-frameworkweb services

I write GUI application on c# for .NET compact framework 1.0 SP3 platform that uses web-services to retrieve data from our server.

When I go far away from access point the connection is lost and next web-service call locks up whole application. Every call surround by try{…}catch{…}, but as far as I can see in logs process never returns from locked web-service call.

What is going on?

Best Answer

What is the timeout of the web service? Have you tried tweaking the timeout?

I would add a Thread.Sleep(5000); in the web service then set the timeout in the client to 2seconds then run with the debugger and make sure that the exception is being caught when it times out. Do this while connected to the network.

Then you'll want to display an error message of some kind if after a certain number of tries the service still times out. Then you'll want to wait for a configurable amount of time before retrying. You'll also want to let the user manually try to reconnect.

Related Topic