微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 断开ManagementScope

我正在使用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.”

正如我在这里找到的:

System.Management – How to disconnect from remote computer?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐