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

后端 未结 7 830
有刺的猬
有刺的猬 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 21:56

    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.

    0 讨论(0)
  • 2020-11-27 21:56

    I found this article which talks more about this issue in depth If this helps, error “80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))” could occur due to following reasons:

    1. The machine has a high CPU load and the process takes a long time to start and fails to execute the CoRegisterClassObjects() in less than 120 seconds.
    2. The COM server doesn't register for the right class IDs.
    3. The COM server is currently stopping and there is a race condition between CoCreateInstance and the COM server stopping part.
    4. There is a security problem in the way the COM server is started (this page seems to suggest misspelled passwords or lacking the "Login as Batch Job" privilege for "Run As.." COM servers, but anyway I would suggest re-verifying this information for your specific configuration)

    https://blogs.msdn.microsoft.com/adioltean/2005/06/24/when-cocreateinstance-returns-0x80080005-co_e_server_exec_failure/

    0 讨论(0)
  • 2020-11-27 21:58

    Same problem was solved for me by "allowing desktop interaction" for the service. (in tomcat6w config tool on Log On tab)

    0 讨论(0)
  • 2020-11-27 22:02

    I fixed this issue with this solution: right click on Component Services/Computers/DCOM Config/Microsoft Word97 - 2003 Document properties/General Tab

    set Authentication Level:None

    0 讨论(0)
  • 2020-11-27 22:03

    Try to add Thread.Sleep Method, such as Thread.Sleep(2000) for 2 seconds after workBook.open and workBook.SaveAs two methods. If your Excel file has a lot of formats, try to extend few more seconds.

    0 讨论(0)
  • 2020-11-27 22:05

    You never want to have Excel on your server side!

    And please believe me, if you must manipulate excel sheets, you do not want to use anything else than Excel. Do not use any library, because sooner or later you run into bugs that not get fixed or cannot be fixed for several reasons (one i.e. being, that Excel is doing something "wrong"). You only use Excel on the client side. Your client has to install and maintain it. If it is there, you use it, otherwise you tell them, that Excel functionality is only working with a valid Excel installation on the client computer

    Use XML, a DataSet, or else, to stream Excel information to the server to store it. Or manipulate that data there with your server side code, but not with Excel.

    Excel interop must always happen on the client computer. It's just like that...

    0 讨论(0)
提交回复
热议问题