我正在运行以下代码:
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 http://windowsxp.mvps.org/repairwmi.htm
正如该页面所述,不同版本的 Windows 之间的修复方法似乎有所不同。
我在这些版本中都没有遇到此问题,但在 Windows Embedded Standard 2009 上遇到了此问题。由于 Windows XP Service Pack 2 与列出的操作系统最相关,因此我使用的是:
对于 Windows XP Service Pack 2
单击“开始”、“运行”并键入以下命令:
rundll32 wbemupgd,UpgradeRepository
此命令用于检测和修复损坏的 WMI 存储库。结果存储在 setup.log (%windir%\system32\wbem\logs\setup.log) 文件中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)