I have a problem with a C# ASP .NET project in Visual Studio 2008 This problem started when I reinstalled my computer with Windows 7 Ultimate (x64). To this I'm also using Office 2007.
The error message I'm getting is:
System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005. at xxx.Utility.WordDocument..ctor(String filePath, HttpServerUtility util) at customer_communication.BuCreate_click(Object sender, EventArgs e) in c:\xxx\Website\customer\communication.aspx.cs:line 127
Here is my fix for this problem:
I'm using Win 7 64bit and Office 2007
Run program "dcomcnfg -32". ( You cant find the word and excel components if it runs under 64bit)
Go to "Console Root/Component Services/Computer/My Computer/DCOM Config/" Look up Microsoft Word and Excel and choose properties.
Go to Security and select "Customize" under "Configuration Permissions. (If needed you might want to change the other permissions as well, but I didn't need to) Add "IIS_IUSRS" and give it "Full Control".
Now go to "Identity" and select "The interactive user".
Do not forget to press "OK" when done. :D
I Hope this helps you with your problem and also the rest who gets here and read this.
You should grant an access to Word COM component for ASP.NET process identity ({MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6):
"Control Panel - Administrative Tools - Component Services - Computers - My Computer - DCOM Config"
Find out "Microsoft Word Document", right click - Settings - Security Tab, grant access (local and remote) for ASP.NET process identity ("ASPNET" for IIS 5, "Network Service" for IIS 6).
If then you get an "System.Runtime.InteropServices.COMException (0x800A13E9): There is insufficient memory. Save the document now." exception when open/add document (my own expirience), just delete temporary files from %Temp% and \Content.Word folders.
launching dcomcnfg -32
or dcomcnfg /32
both failed to show the target app (Microsoft Excel) in the list.
But my following the directions @ How to make IIS7 play nice with Office Interop, in particular, the note about launching mmc -32
and manually adding in the Component Services snap-in, I was able to get it to appear. (NOTE: although the link talks about IIS7, my issue was with a Windows service).
This worked for me:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With