0
            sc.Pause()
            Try
                While sc.Status = ServiceControllerStatus.Paused
                    Threading.Thread.Sleep(1000)
                    sc.Refresh()
                End While
            Catch ex As Exception

            End Try

大家好!

我对上面的代码有疑问。当 sc.Pause() 运行时,它给了我一个例外

'Cannot open Dhcp Service on computer '.' inner Exception Win32Exception: Access is denied

任何帮助表示赞赏!

谢谢,

凯威克斯

4

1 回答 1

0

我想出了一个难题。我更改了 app.manifest 文件以在其中运行

highestAvailable

现在它抛出一个异常

'Cannot pause Dhcp service on computer '.' Inner Exception Win32Exception: The request control is not valid for this service
于 2019-04-02T14:10:21.397 回答