我正在使用 WMI 的 ManagementScope。有一个 connect() 方法,但没有断开连接的方法。我如何断开与 ManagementScope 的连接?
我尝试使用“使用”选项,但它不是 IDisposable,即使我超出了范围,netstat 仍然显示我已连接。
最佳答案
看起来您应该更改作用域的任何属性,它将断开连接:
"A scope is disconnected after creation until someone explicitly calls Connect (), or uses the scope for any operation that requires a live connection. Also, the scope is disconnected from the previous connection whenever the identifying properties of the scope are changed."
正如我在这里发现的:
关于c# - 断开管理范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7011999/