why isn't Microsoft.office.interop.excel DLL working once deployed on server ? RRS feed

  • Question

  • I worked on a function that will export a datatable to Excel XLSX , once i deployed it to a server it stopped working, I tried fixing a few bits here and there and now it's logging this error 

    Exception :System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).   at Globals.Export(DataTable DataT, String FileName, Boolean WithNumbering) <br />Inner Exception :N/A <br />Source :App_Code <br />Data :System.Collections.ListDictionaryInternal <br />StackTrace :   at Globals.Export(DataTable DataT, String FileName, Boolean WithNumbering)

    What's the solution to this ? 


    Monday, August 26, 2019 12:15 PM

All replies

  • Did you do any web searching at all?  This exact question was asked on this forum in 2006.


    Tim Roberts | Driver MVP Emeritus | Providenza &amp; Boekelheide, Inc.

    Monday, August 26, 2019 4:59 PM
  • Hello,

    I would recommend not using Excel automation on a server, instead use Open XML for Excel. There are plenty of free libraries (the link has a mixture of free, trial and paid for libraries) out there that hide the complexities of Open XML such as SpreadSheetLight to name one.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Monday, August 26, 2019 5:34 PM
  • As a matter of fact i did do a lot of web searching and seen this exact same question and did the exact same steps but unfortunately it didn't work. So yeah. 

    Tuesday, August 27, 2019 6:54 AM
  • Hi osamaalhasan,

    Thank you for posting here.

    According to your question, your issue is more related to Microsoft.office.interop.excel. Therefore, it will be more appropriate to ask your question in Excel for Developers Forums

    The C# forum is for C# related question, we discuss and ask the C# programming language, IDE, libraries, samples and tools here.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 28, 2019 9:22 AM