0

Exception: 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)).

I am trying to generate excel file and it is working fine on debugging on visual studio 2015 but as we publish it and run through IIS its start giving this exception...

tried run -> mmc -32 -> component services –> Computers –> My Computer –> DCOM Config and configuration as per many solutions ..

xlApp = new Microsoft.Office.Interop.Excel.Application();

we get exception on this line ... please help ..

Zain Abbas
  • 111
  • 3
  • 15
  • Using `Microsoft.Office.Interop` on a Windows Server is not (officially) supported by Microsoft, and is also very prone to errors. You should look into `OpenXML` (or libraries based on that) for generating excel files in an ASP.NET based website. – bassfader Feb 15 '17 at 11:32
  • @bassfader is there any way to fix that issue :( – Zain Abbas Feb 15 '17 at 11:47
  • 1
    Well most likely the error comes from either Excel not being installed on the Server, or the Useraccount used by IIS doesn't have the permission to run / access the Excel application. So you might get it working after looking into that, though I still want to emphasize that using interop on a Server really is not a good Idea, as it is very prone to errors! You should really look into a different solution that is not based on COM interop. – bassfader Feb 15 '17 at 13:06

0 Answers0