c# – 断开ManagementScope

c# – 断开ManagementScope,第1张

概述我正在使用WMI的ManagementScope.有一个connect()方法,但没有断开连接方法.我如何断开与ManagementScope的连接? 我尝试使用“使用”选项,但它不是IDisposable,即使我不在范围内,netstat仍然显示我已连接. 看起来你应该更改范围的任何属性,它将被断开连接: “A scope is disconnected after creation until 我正在使用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?

总结

以上是内存溢出为你收集整理的c# – 断开ManagementScope全部内容,希望文章能够帮你解决c# – 断开ManagementScope所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1233844.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-06
下一篇2022-06-06

发表评论

登录后才能评论

评论列表(0条)

    保存