how to get the status of the Windows service in aspx page
-
hi , I have created a Windows Service application and it is running in a host.I want to get its status in aspx page.Like whether the service is started or stopped. Is it possible to get status of WindowsService in Asp.net. Plz give ur suggestions.. thanks in advance
cheers sangeet
-
hi , I have created a Windows Service application and it is running in a host.I want to get its status in aspx page.Like whether the service is started or stopped. Is it possible to get status of WindowsService in Asp.net. Plz give ur suggestions.. thanks in advance
cheers sangeet
Assuming that your service is running on the same machine as your ASP.NET application, you could use WMI to query the service status. WMI functionality is exposed through the
System.Management
namespace. Like any system-level functionality, you'll need to have the proper permissions to expose this information. If your service is on a different machine, or you aren't able to secure the proper permissions, you may wish to consider exposing a remoting interface from your service. In that way, you could connect to your service programatically, and ask it for a report of its current status. The catch here is that you'll need to write code in the service that can understand and report on its status. Another thing to be aware of is that if your service is not currently started, the connection will fail. Here are a couple of resources to help get you started:- MSDN Article: Monitoring and Dynamically Configuring Windows Services[^]
- CodeProject Article: Exposing Windows Service[^]
- Google Results for: "WMI and Windows Service and .NET"[^]
Hope that helps. :)
--Jesse