none
Exception occur :The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) RRS feed

  • Question

  • Hi,

    I am using microsoft.office.interop.word.dll for working with word files.

    It gives me an exception "The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))".

    can any one help me.

    THanks

    • Moved by CoolDadTx Monday, June 11, 2012 2:15 PM Office related (From:Visual C# General)
    Monday, June 11, 2012 11:34 AM

Answers

  • Since there's been no better response in the last 24 hours:

    Is there any chance f_objSavedocxName points to a restricted folder, once which might require admin access (e.g. program files)? Is the extension definitely .docx?

    Edit: Also, it may be worth confirming that the document open method has returned a valid result.

    if (m_WordSourceDocument == null)

    // error

    Thursday, June 14, 2012 8:20 AM

All replies

  • To get a good answer, you need to show us your code. Ideally the smallest amount of code possible that is still enough to create the problem.
    Monday, June 11, 2012 2:29 PM
  • Ok thanks for the reply.

     m_WordSourceDocument = m_WordSourceApplication.Documents.Open(ref f_objOpendocName, ref f_objMissing, ref f_objMissing,
                                                                     ref f_objMissing, ref f_objMissing, ref f_objMissing,
                                                                     ref f_objMissing, ref f_objMissing, ref f_objMissing,

                                                                     ref f_objMissing, ref f_objMissing, ref f_objMissing,
                                                                     ref f_objMissing, ref f_objMissing, ref f_objMissing,
                                                                     ref f_objMissing);

    m_WordSourceDocument.Convert();

    when I am trying to save the documents

    as

     m_WordSourceDocument.SaveAs(ref f_objSavedocxName, ref f_objWordFormat, ref f_objLockComments, ref f_objMissing,
                                         ref f_objAddToRecentFiles, ref f_objMissing, ref f_objMissing, ref f_objSavechanges, ref f_objSavechanges,
                                         ref f_objMissing, ref f_objMissing, ref f_objMissing, ref f_objMissing, ref f_objMissing,
                                         ref f_objMissing, ref f_objMissing);

    then it throws an exception

    "The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))".

    Tuesday, June 12, 2012 7:47 AM
  • Are you trying to save it immediately after opening it? It's possible this is happening because Word hasn't finished opening it. To test that, you can have your application wait a second or two before saving it, using System.Threading.Sleep(2000);
    Tuesday, June 12, 2012 10:43 AM
  • Hi

    I try with System.Threading.Sleep(2000);

    but still it gives exception.

    And the exception occurs only on xp machine.

    Works fine on windows 7.

    Tuesday, June 12, 2012 1:31 PM
  • Hmm. I can only think that has something to do with Convert(), because I'm sure many people use SaveAs() on XP machines. If it was your arguments, you'd expect an invalid arguments error. So I'm stumped. Hopefully someone else can help more.

    Although, would you mind saying what you set f_objWordFormat to?

    Tuesday, June 12, 2012 3:40 PM
  • Hi,

    I remove the "m_WordSourceDocument.Convert();",

    just open and try to save it.

     m_WordSourceDocument.SaveAs(ref f_objSavedocxName, ref f_objWordFormat, ref f_objLockComments, ref f_objMissing,
                                         ref f_objAddToRecentFiles, ref f_objMissing, ref f_objMissing, ref f_objMissing, ref f_objMissing,
                                         ref f_objMissing, ref f_objMissing, ref f_objMissing, ref f_objMissing, ref f_objMissing,
                                         ref f_objMissing, ref f_objMissing);

    where'

    f_objWordFormat=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocument;

    f_objLockComments=false;

    f_objAddToRecentFiles=true;

    still it threw exception.....

    Wednesday, June 13, 2012 4:54 AM
  • Since there's been no better response in the last 24 hours:

    Is there any chance f_objSavedocxName points to a restricted folder, once which might require admin access (e.g. program files)? Is the extension definitely .docx?

    Edit: Also, it may be worth confirming that the document open method has returned a valid result.

    if (m_WordSourceDocument == null)

    // error

    Thursday, June 14, 2012 8:20 AM