c# - How to get status of web service -
how can status of web service using c#? whether completed successfully, failed or pending this.
first found question web service database/website status
and should try code;
system.serviceprocess.servicecontroller sc = new system.serviceprocess.servicecontroller("myservice"); return sc.status and should examine code;
public static string pinghost(string args) { httpwebresponse res = null; try { // create request passed uri. httpwebrequest req = (httpwebrequest)webrequest.create(args); req.credentials = credentialcache.defaultnetworkcredentials; // response object. res = (httpwebresponse)req.getresponse(); return "service up"; } catch (exception e) { messagebox.show("source : " + e.source, "exception source", messageboxbuttons.ok); messagebox.show("message : " + e.message, "exception message", messageboxbuttons.ok); return "host unavailable"; } } and should look;
Comments
Post a Comment