How to check windows service status using .Net 6 web application? - windows-services

I need to find a way to monitor the status of a list of Windows services over HTTP using .Net 6 web application.
All I really need to be able to do is display the service name and its status ('Started' / 'Stopped').
Any help appreciated.

You cannot get the status of a windows web service directly AFAIK. I would create a controller for that and call methods on the controller that will return the status of the specified windows service (on the specified server, if that is also a requirement).

Related

Why is it not recommended to host receive endpoints in a web application using MassTransit?

I am working on an ASP.NET MVC 5 application (based on nopCommerce). I want to use MassTransit to communicate with another application that is used for inventory management, billing, etc. It would be easier if I could add receive endpoints directly into the web application and not have to create a Windows service for that. But the MassTransit documentation says it is not recommended and there is no explanation as to why that is.
MassTransit in a web application
Configuring a bus in a web site is typically done to publish events,
send commands, as well as engage in request/response conversations.
Hosting receive endpoints and persistent consumers is not recommended
(use a service as shown above).
Does anyone know the reasoning behind it? Is it not safe to add receive endpoints in a web application? Will they not work properly?
Hosting endpoints in a web application is not recommended because web applications often restart for various reasons. These reasons are typically outside the control of the application itself.
While using a standalone Windows service is highly recommended, as long as the bus is properly started and stopped using the Application_Start and Application_End methods, it can be okay if you have no other options available.

How can I consume a web service on Microsoft Dynamics NAV system from an iOS application?

I need to make an iOS application that can consume a web service on Microsoft Dynamics NAV system. The web service is given in WSDL. I tried to access the service by sending SOAP request but without success. Is there a different approach to consume a WSDL web service on a NAV system ? I am really stuck in here. I would really appreciate some help. Thank you in advance !
My suggestion in this situation is always to create a C# Web Service that will act as a bridge between NAV and your iOS application.
The Web Service use .NET so can easily pull the data from NAV, and because is a Web Service you can consume it by any platform (with SOAP or REST is your decision)

How to connect to a relay service hosted on the service bus in iOS

I want to use Azure service bus in my iOS app to communicate with server i have went through the below link. its pointing to C#.Need suggestions to work on iOS.
http://azure.microsoft.com/en-us/documentation/articles/service-bus-dotnet-how-to-use-relay/#next_steps
You may want to consider using WebHttpRelayBinding for your service so you can hit the Azure endpoint using HTTP / HTTPS.
WCF supports both RESTfull and classic SOAP style messaging but using lightweight json requests in a RESTfull service would be better from a mobile app.
read the following article for details. but you don't need to write custom autostarter if you are using IIS 7.5 or greater with appfabric, since it has autostart functionality in built.
http://msdn.microsoft.com/en-us/library/hh966775.aspx
if you don't need request-response messaging pattern then you can also consider service bus queues for persistence, and your on-premise process can pull and process the messages at its own pace.

Windows Service and MVC communication

I have a windows service (C#) that is getting data from other services, processing that data as saving it on the database.
Now I have monitoring application (C# Windows Forms) that monitors the windows service via TCP and xml messages.
But now I want to change my monitor app to MVC 4 web application.
My problem is how can I send notifications from my windows services to the each current client in my MVC application? The clients may be outside the internal network.
Can someone point me to the best approach?
Thanks
Pedro
You have already done much work:
Now I have monitoring application (C# Windows Forms) that monitors the
windows service via TCP and xml messages.
Pass your messages to the an web service that will be accessible by your MVC 4 web application clients.
you need interface between an windows service and the web application which is either a WCF service or Web Service. You can not access windows service in MVC4 application. If they are same machine or the location of XML message file is known and accessible to you then you can directly consume those in your MVC application.
otherwise the path will be Win Service -> WebService/WCF Service -> MVC4 application

Programmatically Stopping a Windows Service from a Web App

I have a web application running in a GlassFish 3.1 service on Windows 7 and Server 2008. I would like this application to be able to control a number of other services on the same machine. In particular I want it to be able to start and stop Tomcat services.
Essentially the application is acting as a controller for other applications I deploy on the machine so I can set any security necessary on the controlled applications.
I notice that .Net has a ServiceController class so I'm assuming that programmatic control is possible but I would very strongly prefer a pure Java solution if possible.
All the searches I've done turn up a lot of information about running Java as a service and not much on controlling services from Java. Is what I'm trying to do possible? What security hoops will I need to jump through?
You can do Runtime.exec("net stop tomcat6"). Of course tomcat6 can be replaced with any other service name.
Also check out this tutorial
http://www.java-samples.com/showtutorial.php?tutorialid=8

Resources