C#   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了c# – System.Management.ManagementException:未找到大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在运行以下代码

@H_744_7@managementClass oMClass = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection colMObj = oMClass.GeTinstances();

抛出这个异常:

System.Management.Managementexception: Not found 
at System.Management.ThreadDispatch.Start()
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObject.Initialize(Boolean getObject)
at System.Management.ManagementClass.GeTinstances(EnumerationOptions options)
at System.Management.ManagementClass.GeTinstances()

我去检查Windows XP上正在运行的服务,发现Windows Management instrumentation服务的状态为“已启动”.我尝试重新启动服务,但这没有任何好处.
然后我尝试使用serviceController类从我正在运行的代码获取此服务的状态:

serviceController wpiservice = new serviceController();
wpiservice.servicename = "Winmgmt";
String wmiStatus = wpiservice.Status.ToString();
messageBox.Show("WMI status= " + wmiStatus);

wmiStatus评估为“正在运行”.

我只在运行相同软件的多台机器中的一台机器上看到此错误.奇怪的是,机器运行了几个月,然后突然开始出现这个错误.

有什么可能导致这个的任何线索?

解决方法

我也遇到过这个问题.以下是前面提到的在线资源之一,解释了如何修复WMI:
http://windowsxp.mvps.org/repairwmi.htm

修复方法在不@R_12_11197@的Windows之间似乎有所不同,如该页面所述.

在这些版本上都没有这个问题,但是在Windows Embedded Standard 2009上.由于Windows XP service Pack 2与列出的操作系统最相关,所以我使用的是:

大佬总结

以上是大佬教程为你收集整理的c# – System.Management.ManagementException:未找到全部内容,希望文章能够帮你解决c# – System.Management.ManagementException:未找到所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。