Sometimes when working with office Interop assemblies the above mentioned error occurs. I had also got the same when using Microsoft Excel interop assembly and adding its reference in my ASP.NET application.





The problem is that by default when Microsoft Excel is used as a COM object then it can only be activated by the following accounts:

  1. Administrator
  2. System
  3. Interactive

And when you are running your web application on windows server 2003, it is running under ASPNET account.

The way to resolve this issue is to edit the DCOM configuration settings for Microsoft Excel Application object.

Configure DCOM

  1. Go to Start -> Run.
  2. Type DCOMCNFG. (This will load the “Component Services”)
  3. Go to Component Services -> Computers -> My Computer -> DCOM Config -> Microsoft Excel Application.
  4. Right click and select Properties.
  5. Select the Security tab.













  • In “Launch and Activate Permissions” select Customize and press the Edit button.












Press Add button to select the “Network Service” account.


















Click the OK button, and then test your application, it should work fine now.