Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
We have a ASP.NET app that uses the Word 2007 to open a file and publish it as a PDF. This works fine when we run it in Visual Studio 2008 in Debug, but when we run it as a normal website we get the following error:
System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005.

We have been looking for a solution for 2 days and we have given ASPNET access to the DLL.
When we put Impersonation into web.config and given it a Username and password this error went away, but was replaced by:
System.NullReferenceException: Object reference not set to an instance of an object.

So while it seems to get us around the security problem, it is not actually instantiating the Word obect it would seem.

Does anyone have any help for us? We are developing on IIS7 with Word2007 intalled on the machine.
Posted
Updated 6-Sep-11 19:50pm
v2

Could it be that the account running the code does not have necessary privileges for COM operations. Use dcomcnfg.exe to check the necessary privileges.

Also have a look at this conversation: http://www.codeguru.com/forum/printthread.php?t=383912&page=3&pp=15[^]
 
Share this answer
 
IIS7 on Win Server 2008 ?
Create a new "Desktop" directory inside of "C:\Windows\SysWOW64\config\systemprofile\" and give access Modify of NetworkServices and User group.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900