Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检索在服务器vb.net上运行的服务列表_Vb.net_Windows Services_Wmi_Wmi Query - Fatal编程技术网

检索在服务器vb.net上运行的服务列表

检索在服务器vb.net上运行的服务列表,vb.net,windows-services,wmi,wmi-query,Vb.net,Windows Services,Wmi,Wmi Query,我正在寻找一种方法来获取服务上运行的所有服务的名称和状态的详细信息。我确实使用了以下代码: Public Sub GetServices() Dim localServices As ServiceController() = ServiceController.GetServices() For Each service As ServiceController In localServices If Not String.IsNullOrEmpty(s

我正在寻找一种方法来获取服务上运行的所有服务的名称和状态的详细信息。我确实使用了以下代码:

    Public Sub GetServices()
    Dim localServices As ServiceController() = ServiceController.GetServices()
    For Each service As ServiceController In localServices
        If Not String.IsNullOrEmpty(service.DisplayName) Then
            dictservice(service.DisplayName) = New Service(service.DisplayName, service.ServiceName, service.Status.ToString)
        End If
    Next
End Sub
但是,由于我已将项目打包为WCF服务,因此无法使用我使用的System.ServiceProcess命名空间:


有没有其他方法可以检索相同的详细信息?可能是通过wmi?

消息的意思是,当尝试导入名称空间时,名称空间中没有任何内容,或者找不到名称空间

通常这只是缺少引用的情况,是否确实已在项目中添加了对System.ServiceProcess的引用