我正在使用ASP.net(C#)编写Web应用程序。我在服务器上有一个我想读的excel文件。当我尝试使用下面的代码读取这个excel文件时,它会抛出异常。我已经为服务器上的用户(IIS用户)提供了完整的权限,用于保存excel文件的特定文件夹。使用C#读取ASP.net中的excel文件时,访问被拒绝
阅读逻辑:
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");
例外:
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)).
能否请你帮我理解这个问题?