A recent project forced me to try to use the COM-based Office Interop stuff ... painful. I found some example code and tried to get it to run, but kept getting a System.UnauthorizedAccessException "Retrieving the COM class factory for component with CLSID ..." exception on this line of code:
ApplicationClass excelApplication = new ApplicationClass();

Although the exception above didn't give me much direction, I was able to uncover more details when I went to view the same error in the computer's event log:
"The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {00024500-0000-0000-C000-000000000046} to the user DOMAIN\USER SID (S-1-5-21-789336058-854245398-1417001333-2107) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool."

Turns out you have to configure some COM security stuff on the computer before you can actually make a call like this. Here is what you have to do to adjust the settings.
- Figure out what application the CLSID GUID represents. To do this you have to look in the registry. So run "regedit" and go to Computer\HKEY_CLASSES_ROOT\CLSID and find the related CLSID folder. In my case, the error was related to "Microsoft Office Excel Application."

- Open the "Compenent Services" configuration window by running "dcomcnfg".

- Find the related app like shown below, and then right-click on it and go to "Properties"

- In the "Properties" window go to the "Security" tab. Then under "Launch and Activation Permissions" click the "Customize" radio button, then click edit.

- Add the account the code is executing as and give them the appropriate permissions:

- Then go back to the "Component Services" configuration window and right-click on "My Computer" and go to "Properties":

- Under the "COM Security" tab find the area for "Launch and Activation Permissions" and click the "Edit Default" button.

- Add the account and set the permissions like we did in step 5.
That should be it. Try the code again and it should run (or at least get you past this particular exception). So far, my experience with COM is that it is painful and should be avoided at almost any cost. In my scenario though, it seems to be the only viable option out there, because no 3rd party component has the particular feature I needed ... so sometimes this is unavoidable, and I hope these instructions make it a little less painful for you.