简体   繁体   English

通过Web应用程序(浏览器)管理ASP.NET Windows服务

[英]Manage ASP.NET Windows Service from a Web Application (browser)

I have number of windows service (around 10) all are developed in ASP.NET C#. 我有许多Windows服务(大约10个)都是在ASP.NET C#中开发的。 And are installed on Windows Web Server 2008. If I wanted to start or stop the service I have to log in to the Windows Web Server and then Start/Stop the service. 并且已安装在Windows Web Server 2008上。如果我想启动或停止该服务,则必须登录Windows Web Server,然后启动/停止该服务。

在此处输入图片说明

I wanted to manage this activity through a Web Portal which I wants to create in ASP.NET C#. 我想通过要在ASP.NET C#中创建的Web门户来管理此活动。

Does anybody any idea or have any reference that how it can be done? 是否有人对如何实现有任何想法或参考?

You can create a web service that controls the service via rest calls and run that web service on the server. 您可以创建一个通过Rest调用控制该服务的Web服务,然后在服务器上运行该Web服务。 Then use jquery to make rest calls from a web page ( on that server) using $.post() or $.ajax() or JavaScript native xmlhttprequest 然后使用jquery使用$ .post()或$ .ajax()或JavaScript本机xmlhttprequest从网页(在该服务器上)进行其余调用

Visual studio web has project templates for web services that can get you started. Visual Studio Web具有用于Web服务的项目模板,可以帮助您入门。 The service start stop can be using this example 服务启动停止可以使用此示例

http://www.csharp-examples.net/restart-windows-service/ http://www.csharp-examples.net/restart-windows-service/

如果您的Web门户将与服务一起发布在同一台计算机上,则可以使用ServiceController类https://msdn.microsoft.com/zh-cn/library/system.serviceprocess.servicecontroller(v=vs.110).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM