DotNetMania wrote:
i'm woking with webservice ...
how should the client do when webservice service is down.
what kind of exception would occur..
when my testing it always wait server's signal...
I think all the exceptions will be of class WebException. This class
gives you a bunch of information about just what went wrong, but it
isn't easy to get at it sometimes.
What I do is this:
public static string WebExceptionMessage(WebException ex)
{
switch(ex.Status)
{
case WebExceptionStatus.ConnectFailure:
return "Unable to connect to the Internet";
case WebExceptionStatus.NameResolutionFailure:
return "Unable to resolve the server's address";
case WebExceptionStatus.Timeout:
return "Timeout waiting for the server to respond"
}
if (ex.Response is HttpWebResponse)
{
HttpWebResponse response = (HttpWebResponse) ex.Response;
if (response.StatusCode == HttpStatusCode.NotFound")
{
return "Web server contacted, but the web service was not found.";
}
else
{
return "Some other error happened";
}
}
}
R.