System.Management.ManagementException:未找到 [英] System.Management.ManagementException: Not found

查看:1954
本文介绍了System.Management.ManagementException:未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行下面的code:

I am running the following code:

ManagementClass oMClass = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection colMObj = oMClass.GetInstances();

这是引发此异常:

which is throwing this exception:

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的类从我的跑步code得到此服务的状态:

I went to check on the running services on Windows XP and found that Windows Management Instrumentation service has a status of 'Started'. I tried restarting the service but that didn't do any good. I then tried to get the status of this service from within my running code using the ServiceController class:

ServiceController wpiService = new ServiceController();
wpiService.ServiceName = "Winmgmt";
string wmiStatus = wpiService.Status.ToString();
MessageBox.Show("WMI status= " + wmiStatus);

wmiStatus计算结果为正在运行。

wmiStatus evaluates to 'Running'.

我看到的只有一个运行相同的软件多台机器上的这个错误。什么是独特的是,该机顺利几个月运行,然后突然开始出现此错误。

I have seen this error on only one of multiple machines running the same software. What's peculiar is that the machine was running smoothly for months, and then suddenly started showing this error.

任何线索,以什么可能会导致什么呢?

Any clue as to what might be causing this?

推荐答案

解决方案是修复WMI在Windows XP上。我没有一步修复的详细步骤(我不是谁实施了修复的),但我的理解是,与此相关的服务存储库可以破坏,并有一个Windows实用程序可以修复它​​。对于如何做到这一点的几个在线资源。

The solution was to repair WMI on Windows XP. I don't have the detailed step by step fix (I'm not the one who implemented the fix), but my understanding is that a repository related to this service can get corrupted and there's a Windows utility that can repair it. There are several online resources on how to do this.

这篇关于System.Management.ManagementException:未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆