469,579 Members | 1,899 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

when webservice service is down.

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...

best regards
Nov 21 '05 #1
1 2237
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.
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Sanjay | last post: by
reply views Thread by RichardF | last post: by
5 posts views Thread by =?Utf-8?B?cnZhbmdlbGRyb3A=?= | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.