Serge Calderara

Dear all,

I have buils a WCF service which is host for the time beeing in a console application just for test.

in final release it will be host as WAS or Windows Service. Do not know yet.

But wherever the servcie will be host, how can I retrive the service status somehow

What I mean by that is that if my Service adress is :

"http://localhost:8080/myservice" or "net.tcp://localhost:8000/myservice"

When my client WCF try to connect to the service through the proxy, if the service is not available for any reason, I would like to return to my client UI a message like "Service not available". In a similar way as Vista gadget does when internet connection is closed.

How to retrive this information

thnaks for help

regards

serge




Re: Windows Communication Foundation (Indigo) How to know that Service not available `???

BenK

I normally use a description method of the service which has the hosting uri and some version information . I call this at startup and if i get an exception you can say service unavailable .

If you want it all the time , this is much harder as you have to destinguish between network unavailable ( in which case the service is unavailable ) and the server being down. In most cases its enough to catch an exception and say service down if you have an exception Sometimes you will need a keep alive poll to display this - if you dont have regular calls to a service.

Regards,

Ben





Re: Windows Communication Foundation (Indigo) How to know that Service not available `???

Serge Calderara

Thanks for your reply.

As you said the best way for me is that I should display this" Serveice not availble infomation" as soon as something goes wrong.

As you connect to the service only when you need service from it, the connection is in a way Read and forget, in the sens that as soon as the service return what you are requesting, you have know idea about the status of the service if you are not requesting anything else.

from my case my service is suppose to provide live statistical information from a database view.

my client application should display those information for instance every 10 seconds, or when a data gets updated.

So how would you handle this service status in that case

thaks

serge






Re: Windows Communication Foundation (Indigo) How to know that Service not available `???

John Lambert - MSFT

If your client needs to be updated when the server wants it to be, you'll probably need to use callbacks. (See the MSDN samples for callback contract.)

If your client needs to update the status based on when it wants to be (every 10 seconds), use a background thread.

If you want to be notified on the client of client network disconnections (the server may still be up), try the NetworkChange API's:

Code Block

NetworkChange.NetworkAvailabilityChanged += delegate(object sender, NetworkAvailabilityEventArgs args) { Console.WriteLine(" IsAvailable " + args.IsAvailable); };






Re: Windows Communication Foundation (Indigo) How to know that Service not available `???

Serge Calderara

The idea is that I have a user control on a winform, but it can be also an ASP page, which is suppose to received updated data for instance has soon as something change from the back end database or in a timer based..

In timer based for instance, the client content could be updated every 15 mn..

In case the service is not available on the next update, I need the control to display "Service Not available", and as soons as connection gets back, client should be updated imeediatly..

Call back then

regards

serge






Re: Windows Communication Foundation (Indigo) How to know that Service not available `???

BenK

Hi Serge ,

This is a pain of a requirement for every 15 serconds or every monute just poll and if you get an error display not available . However you need to know if the server is not available .

If you have a few clients you can poll every second. For lots of clients i cant really see a nice solutions - callbacks are not appropriatre because you may get the callback from the service app domain but the receiver WCF may have an issue ( eg firewall mis configuration) or you can even get the callback after a fault as its handled by the domain.

Only choices here are a 1second poll or a combination of using a light weight poll such as ping to poll and handle major issues such as firewall , machine down or try to open a socket on the port ( which will cover service down) . And relly on the applications call to pick up most app errors.

I had a smilar requirement from people used to 2 Tier DB access and there its easy for lots of cutomers in n tier its a pain.

Regards,

Ben