简体   繁体   English

在VB.NET应用程序中使用服务的最佳方法是什么?

[英]What is the best way of working with Services in a VB.NET application?

I'm using VB 9 (VS2008). 我正在使用VB 9(VS2008)。

I would like to know how to do the control Windows Services through an Windows Forms application. 我想知道如何通过Windows窗体应用程序来控制Windows服务。

I want to know: 我想知道:

  1. How to determine the status of a service? 如何确定服务状态?
  2. How to change the Startup type of the service? 如何更改服务的启动类型?
  3. How to start, stop, pause and resume a service? 如何启动,停止,暂停和继续服务?

Thank you! 谢谢!

框架类ServiceController允许您执行所有这些操作。

I'm pretty sure that (unless they changed stuff recently) you'll have to do this either through p/invoke's or through WMI. 我非常确定(除非他们最近更改了东西),您将必须通过p / invoke或通过WMI来执行此操作。

Wow, how did I forget about that class. 哇,我怎么忘了那堂课。

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

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