加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 断开ManagementScope

发布时间:2020-12-15 17:19:06 所属栏目:百科 来源:网络整理
导读:我正在使用WMI的ManagementScope.有一个connect()方法,但没有断开连接方法.我如何断开与ManagementScope的连接? 我尝试使用“使用”选项,但它不是IDisposable,即使我不在范围内,netstat仍然显示我已连接. 解决方法 看起来你应该更改范围的任何属性,它将被断
我正在使用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?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读