c# - How to know WCF service availability? -
i want know whether wcf service available or not before making service call. best way?
how using this:
bool isserviceup = true; try { string address = "http://localhost/myservice.svc?wsdl"; metadataexchangeclient mexclient = new metadataexchangeclient(new uri(address), metadataexchangeclientmode.httpget); metadataset metadata = mexclient.getmetadata(); // if service down exception } catch (exception ex) { isserviceup = false; } my service using net tcp binding.
can use net tcp binding?
edit: jaredpar. suppose first call gets succeeded , while second call server down. before making service call check state of proxy in open state , hence make service call gets time out. haven't set open or close time out default takes 1 minute , call gets caught in fault event handler of service in dispose proxy. time ui hangs , shd do?
please guide.
this type of test not possible. there no way reliably detect if given wcf, or networking call, succeed before attempt it. there many variables outside control.
- the physical network
- the power source on machine wcf running
- the actual wcf program
- the stability of hard drive on computer code or wcf code running
any of these can terminated / changed @ point in time. hence it's impossible predict whether or not given call succeed.
the best way approach problem make call add code handle cases fail.
Comments
Post a Comment