I am writing web application using ASP.net (C#). I have one excel file on server which I want to read. When I try to read this excel file using below code then it throws exception. I have provided full rights to user (IIS User) on server for particular folder where excel file kept.
Reading Logic:
Excel.Application xlApp = null;
Excel.Workbook xlWorkbook = null;
Excel._Worksheet xlWorksheet = null;
Excel.Range range = null;
xlApp = new Excel.Application();
xlWorkbook = xlApp.Workbooks.Open("C:\inetpub\wwwroot\Uploads\data.xls);
xlWorksheet = (Excel.Worksheet)xlWorkbook.Worksheets.get_Item(sheetName);
range = xlWorksheet.get_Range("A1", "B5");
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)).
Can you please help me to understand this error?