Reputation: 5959
i have just developed an app that uses system.manament class, but my friend is having problem using the app as it gives errors. He has winxp sp3 and .Net framework 2.0 installed, just as i have.
System.TypeInitializationException: The type initializer for
'System.Management.MTAHelper' threw an exception. ---> System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {A8F03BE3-EDB7-4972-821F-AF6F8EA34884} failed due to the following error: 80040154. at System.Management.MTAHelper..cctor()
how can i deploy this application making sure wmi is present? what could be the problem?
Upvotes: 2
Views: 1406
Reputation: 17350
Make sure that WMI is running. In command line:
net start winmgmt
If you distribute your app as windows service you can put a dependency on WMI during service installation. It is also worth looking at this:
So I went to HKCR\CLSID{A8F03BE3-EDB7-4972-821F-AF6F8EA34884}\InprocServer32(Default) in my x64 environment, and saw the following path: C:\Windows\system32\mscoree.dll.
Customer changed the C:\WINDOWS\SysWOW64\mscoree.dll path he found in there to the right one, and he didn't get the error again.
If you serch registry as Ken White suggests and it does not have 'HKCR\CLSID{A8F03BE3-EDB7-4972-821F-AF6F8EA34884}' it might be worth reinstalling .NET. Also look at this.
Upvotes: 2
Reputation: 125749
The 0x80040154
HRESULT
error given in the message means that the COM class used is not registered on the system. (It can also mean that a dependent class isn't registered; your COM class can't resolve the dependency and this error code is returned causing the exception to be raised.)
There are obviously differences between the operating systems or frameworks installed on your machine and your friend's. We can't tell you what they might be, because you didn't post any code. You can probably start tracking it down by searching the Windows registry on your machine for the CLSID
shown in the error message ({A8F03BE3-EDB7-4972-821F-AF6F8EA34884}
).
Upvotes: 2