none
Exception while initializing the word application using microsoft.office.interop.word in c# (Retrieving the COM class factory for component with CLSID....) RRS feed

  • Question

  • Hi 

    I am using Microsoft.Office.Interop.Word in my WPF application to get the instance of the word, below is code snippet

    using EZI.ADTool.Log4netLogger;
    using System;
    using System.Collections.Specialized;
    using System.IO;
    using System.Text;
    using System.Threading;
    using System.Windows;
    using telerik = Telerik.Windows.Documents.Proofing;
    using wordApplication = Microsoft.Office.Interop.Word;
    
    namespace WordTestDemo
    {
        public class WordTest
        {       
            public static string GetWord()
            {
                var wordApp = new wordApplication.Application();
                //Other Code....
                //Other Code....
                //Other Code....
            }
        }
    }


    but sometimes it gives the exception.

    Exception 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))

    Below is the Error trace of exception

    NameSpace : System.Runtime.Remoting ,
    Class Name : System.Runtime.Remoting.RemotingServices ,
    Method Name : AllocateUninitializedObject ,
    Exception 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)). ,
    Error Trace :    at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
       at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
       at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
       at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
       at System.Activator.CreateInstance(Type type, Boolean nonPublic)
       at System.Activator.CreateInstance(Type type)
       at EZI.ADTool.UI.MainApplication.SpChk.CustomDictionary.GetRegisteryKey()
       at EZI.ADTool.UI.MainApplication.SpChk.DocProofing.get_TelSpellchecker() 
    Inner Exception:  

    Please let me know the reason and possible solution for this exception.

    Thanks in advance

    Ankur R.


    • Edited by ankurastogi Tuesday, February 27, 2018 7:18 AM
    • Moved by Bob Ding Friday, March 2, 2018 6:21 AM
    Tuesday, February 27, 2018 7:18 AM

All replies