Excel Interop Used In Web Service

If you are using the Excel Interop in a web serviceĀ or even a web page you may get the following error.

Error:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

Generally speaking you probably should not be trying to use the Excel application from a web services or web page for security reasons; however, for my purpose I needed to do some manipulation at the server level. If you must use the Excel interop at the server level you can use the following to get around the error. Just be careful as you may be opening a security nightmare by possibly allowing remote access to it by viruses or other rogue services.

Solution:

goto Controlpanel –>Administrative tools–>Component Services –>computers –>myComputer –>DCOM Config –>Microsoft Excel Application.
right click to get properties dialog. Goto Security tab and customize permissions accordingly.
In Launch and Application Permissions, select Customize, Edit. Add the user / group that calls the application.

Posted in Excel, Interop, Web Service