Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))

后端 未结 7 831
有刺的猬
有刺的猬 2020-11-27 21:46

I am trying to convert a .xls file to an .xlsx file on the server-side using Microsoft.Office.Interop.Excel.Workbook class as follows:

 workBook         


        
相关标签:
7条回答
  • 2020-11-27 22:06

    I found the solution elsewhere.

    Doing the following did solve my problem:

    Using DCOMCNFG.exe. Open it and go to: Component Services -> Computers -> My Computer -> DCOM Config -> Microsoft Excel Application. Open the properties, select Identity tab and select the interactive user.

    BUT - the problem came back every few minutes !

    After hours of trying to figure out the cause, I noticed my server had hundreds of opened WINWORD.EXE processes. This caused a memory issue which leaded to the exception from hresult 0x80080005 error.

    Well, stupidly enough, I forgot to write the code to close the interop application. Once I fixed that, the error was gone.

    doc.Close(false);
    Marshal.ReleaseComObject(doc);
    word.Quit();
    Marshal.ReleaseComObject(word);
    
    0 讨论(0)
提交回复
热议问题