ApplicationClass Error After deployment RRS feed

  • Question

  • User192444953 posted

    Hi Experts :)

    I have developed an application which responsible to create a word file and put some content in it. It works perfectly when I F5 from visual studio. But when I put my same code/publish code into inetput/wwwroot/MyApp it give me permission error: "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005." I am stuck in it and unable to deploy my application. Following is the code:

                    //creating object for missing value
                    object missing = System.Reflection.Missing.Value;
                    //object for end of file
                    object endofdoc = "\\endofdoc";
                    //creating instance of word application
                    Microsoft.Office.Interop.Word._Application w = new Microsoft.Office.Interop.Word.Application();
                    //creating instance of word document
                    Microsoft.Office.Interop.Word._Document doc;
                    //setting status of application to visible
                    w.Visible = true;
                    //creating new document
                    doc = w.Documents.Add(ref missing, ref missing, ref missing, ref missing);
                    //adding paragraph to document
                    Microsoft.Office.Interop.Word.Paragraph para1;
                    para1 = doc.Content.Paragraphs.Add(ref missing);
                    object styleHeading1 = "Heading 1";
                    para1.Range.set_Style(ref styleHeading1);
                    para1.Range.Text = "Heading One";
                    para1.Range.Font.Bold = 1;
                    para1.Format.SpaceAfter = 24;
                    //creating second paragraph
                    Microsoft.Office.Interop.Word.Paragraph para2;
                    para2 = doc.Content.Paragraphs.Add(ref missing);
                    para2.Range.Text = "Heading OneHeading OneHeading OneHeading OneHeading OneHeading OneHeading" + '\n' + "OneHeading OneHeading OneHeading OneHeading OneHeading OneHeading One";
                    para2.Range.Font.Bold = 1;
                    para2.Format.SpaceAfter = 24;
                catch (Exception ex)
                    ClientScript.RegisterStartupScript(this.GetType(), "error", "javascript:;alert('" + ex.Message + "')");

    Saturday, December 14, 2013 9:12 AM


  • User-166373564 posted

    Hi rmsohaila

    "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005."

    Can you try the suggestions below:

    • Change the AppID Registry key under HKEY_CLASSES_ROOT\AppID\WINWORD.EXE from old entry to {00020906-0000-0000-C000-000000000046}.

    (for some it will work after this, but if still its not working go for second.)

    • Change the DCOM setting.
      • a. Open the Component Service Console.(Either by running command: dcomcnfg OR by opening it from Control Panel->Administrative Tool -> Component Services)
      • b. Now Select ‘Microsoft Word Document’, Under Component Services->Computers->My Computer -> DCOM Config.
      • c. Do Right click and select Properties. it will open Microsoft Word Document Properties dialog.
      • d. In Microsoft Word Document Properties dialog, select Identity tab.
      • e. In Identity tab, if ‘The launching user.’,  third option was selected, so we selected 2nd option.

    Please check whether it works fine on your side, at the same time you can also search relevant solutions online for this error message.

    Best regards


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 23, 2013 1:18 AM