Link to home
Start Free TrialLog in
Avatar of CipherIS
CipherISFlag for United States of America

asked on

.NET MS Interop Word - COM Class Factory Error

I am developing a .NET 2012 application and using Microsoft.Interop.Word.  When my code gets to the sample code below it breaks in the Initialize method:

public class eobPrintBatch
{
    private Microsoft.Office.Interop.Word.Application wApp;

    private void Initialize()
    {
        wApp = new Microsoft.Office.Interop.Word.Application();  //Breaks here
    }
}

Open in new window


The error I am receiving is:

{"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    [System.Runtime.InteropServices.COMException]: {"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    InnerException: null
    Message: "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."
    Source: "PrintApp"
    StackTrace: "   at Print.PrintBatch.Initialize() in c:\\Apps\\PrintApp2012\\PrintBatch.cs:line 277\r\n   at PrintApp.PrintBatch.DoMonitor() in c:\\Apps\\PrintApp2012\\PrintBatch.cs:line 86"
    TargetSite: {Void Initialize()}

Open in new window


Any ideas?
Avatar of Daniel Van Der Werken
Daniel Van Der Werken
Flag of United States of America image

Are you using the Microsoft Primary Interop Assemblies?

Basic info on PIA's:
http://msdn.microsoft.com/en-us/library/aax7sdch(v=vs.110).aspx

More information on Office PIA's:
http://msdn.microsoft.com/en-us/library/15s06t57.aspx

My best guess on this is that the .NET application is trying to load the appropriate Office COM object and unable to find it. You need to make sure you have the correct PIA's installed and properly "configured" to work with the correct version of Office on that system.
Avatar of CipherIS

ASKER

I removed the Interop and re-added it.  Now I'm receiving

{"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."}
    [System.Runtime.InteropServices.COMException]: {"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    HResult: -2146959355
    InnerException: null
    Message: "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."
    Source: "mscorlib"

Open in new window

Now its back to its original error:

{"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    [System.Runtime.InteropServices.COMException]: {"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    InnerException: null
    Message: "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."
ASKER CERTIFIED SOLUTION
Avatar of CipherIS
CipherIS
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Had to reinstall office.