Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a webservic which store data from one database to another. Now i want to know my webservice status on .aspx page means it is working or not. And also i want start and stop webservice on button click event. If yes then how please healp me.
Posted

Hi,

You can check particular web service is exists or not by using my code

C#
WebRequest req = WebRequest.Create("http://www.webservicex.net/ConvertAcceleration.asmx");
 try
 {
     WebResponse res = req.GetResponse();
 }
 catch (Exception es)
 {
     //Handle that here
 }


If you give wrong webservice url it just raise Exception.In that catch method you can write user friendsly msg


And you can use dispose method to disable webservice .Am not sure about this

but you can try that .

You can disable and enable webservice which is in your local website.

Here I'm providing some links to understand more about webservices.

http://msdn.microsoft.com/en-us/library/ms972326.aspx


All the Best
 
Share this answer
 
Comments
NeerajYadavMca2k5 23-Sep-11 4:12am    
Thanks For Repply.

it is working .
try:

System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController("myService");
return sc.Status;
 
Share this answer
 
Comments
NeerajYadavMca2k5 23-Sep-11 4:12am    
Thanks For Repply.
bharatwaj vanamamalai 12-Jun-15 8:34am    
ServiceController are used only to control the WindowsService and not the Web.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900