Using Microsoft.Office.Interop.Excel in IIS
Exception 1:
Failed to retrieve a component of the CLSID {00024500-0000-0000-c000-000000000046} in a COM class factory because of the following error: 80080005.
Solution:
A. Check that the user groups on the IIS published Web site have administrators user rights
B, configure the COM component, open the Command Run window with the Win+r command, enter the DCOMCNFG command, enter the Component Services Configuration interface, locate "Microsoft Excel Application", configure "Security" and "identity":
All three should be customized and configured as everyone, as follows:
Configure identity, select the following user, configure as Administrator user, password is the user's login password:
Exception 2:
The RPC server is not available. (Exception from HRESULT:0X800706BA)
Solution:
The following code does not throw an exception in some versions of the Windows system:
Excel.Application Excleapp =NewExcel.Application (); Excel.Workbook Workbook=ExcleApp.Workbooks.Open (Reportfilepath); Try {
//... } Catch(Exception ex) {Throw NewException (ex. Message); } finally{workbook. Save (); //Resource CleanupExcleapp.quit (); System.Runtime.InteropServices.Marshal.ReleaseComObject (workbook); System.Runtime.InteropServices.Marshal.ReleaseComObject (Excleapp); Gc. Collect (); }
But some versions
Frequently asked questions in IIS using Microsoft.Office.Interop.Excel