locked
System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SER RRS feed

  • General discussion

  • Hi all,

    I'm developing a simple web app that require to upload some files (.xlsx). On the server side I open and read those and save the data on a database. On Visual Studio all is working fine but now, I have deployed my app on IIS and it stop working. If I try to run the function that have to read those files I get this error:

    [COMException (0x80080005): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).]

    What does it mean? How can I fix it?

    Note: before I had an another error (something like this):

    Retrieving the COM class factory for component… error: 80070005 Access is denied.” (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))


    fixed thanks to a guide: tutorial.

    Thanks


    • Edited by Mond089 Thursday, January 5, 2017 1:32 PM edit
    Thursday, January 5, 2017 1:31 PM

All replies

  • Hi Mond89 -

    A couple questions to get this in the right area:

    (1) Is your Dev machine a different machine than your IIS?

    (2) Is Excel available on the machine running IIS? In other words:

    (3) Did you deploy the Interop assemblies with your application or did you actually install Excel in the IIS machine?

    (4) What OS is the IIS running on?

    (5) Was a previous version of your app successfully running successfully on the IIS machine before you deployed (this) revision?


    -MainSleuth

    Thursday, January 5, 2017 2:42 PM
  • Hi,

    1 - Yes, it's a different machine;

    2 - Yes, Microsoft Office has been installed on that machine (BUT it's a different version --> 2013 on the server, 2016 on my pc. Is it important? );

    3 - I just took my publish folder (that contains all assemblies, so also the Microsoft.Office.Interop.Excel.dll I suppose) and deployed it. On the server there was alreadya version of Excel installed;

    4 - Windows Server 2012;

    5 - It's the first time I'm trying to deploy this app;

    Thanks.

    Thursday, January 5, 2017 3:12 PM
  • When I develop for an Excel, I use the earliest interop available, so in your case I'd have used 2013. If I recall, your app is using the first interop it can find, which is the one you published (2016), which is now trying to communicate with Excel 2013.

    This article may give you more relevant information, as the case is similar:

    https://social.msdn.microsoft.com/Forums/en-US/be46d920-323f-4f4d-af66-a211930557b1/microsoft-office-interop-excel?forum=vbgeneral

    For DCom/COM+, this article has some additional steps to consider whle diagnosing the root cause:

    http://stackoverflow.com/questions/13402262/system-runtime-interopservices-comexception-0x80080005-retrieving-the-com-cla

    Two other questions come to mind: Does Excel run on the target machine (kind of a dumb question, I know...), Is it Current? and have you confirmed that the User IIS is executing under has access / privileges to run the excel executable?

    Beyond that, I'm tapped out - mostly because I've avoided installing any Office product on a server.


    -MainSleuth


    • Edited by MainSleuth Thursday, January 5, 2017 4:21 PM Clarity
    Thursday, January 5, 2017 4:17 PM
  • Hi,

    with the version 2016 installed on the server this error has been fixed. Anyway now I keep getting errors. Since it seems the use of Office automation on the server side is not supported even from the Microsoft, I'm moving to adopt another method to read .xlsx files (like Open XML).

    Tuesday, January 10, 2017 1:53 PM