Accessing the Office Word object model using asp.net results in "failed due to the following error: 80070005 Access denied."

I developed a website that allows users to upload office documents, and then uses the office object model to convert the document into an HTML file, which it then displays in an iFrame.

Of course, I included links to Office.interop.word, and the site works fine on my development machine. When I uploaded it to my production server, the site functions normally until I try to upload the document. At first, I got a similar error, indicating that "the COM object is not registered." I realized that Word was not installed on my production server. So I installed the word and now that the server is trying to access the word object model. I get the following error:

Retrieving the factory COM class for a component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I searched the registry for the corresponding CLSID and found the appropriate folder. I added full control over the IUSR_ account and, due to a constant error, I eventually added full control to "everyone" and ensured these rights inherited to the rest of the folder. Then I added full control of IUSR_ and again eventually added complete control of “everyone” to my Microsoft Office folder.

I do not know what other permissions to provide, and where in order for this "Access Denied" error to go away. I have to provide them in the wrong place, because I know that I cannot be more believable than "All" "Full control".

Can anyone shed some light?

+43
c # office-interop
Aug 13 '10 at 13:10
source share
5 answers

This worked for me:

  • At the command prompt, enter DCOMCNFG
  • Component Services → Computers → My Computer → DCOM Configuration
  • Search for "Microsoft Word 97 - 2003 Document" (if it is missing, check if your Word is also 64-bit (if your Windows))
  • Right click -> Properties
  • Go to the Security tab and Edit the Configure switches so that IIS_IUSRS can have launch and access rights.
  • Go to "Tab ID" and select "Interactive User"
  • Apply changes and try again
  • If all this fails, go to the General tab and select "None" from the "Authentication Level" drop-down list.
+24
Oct 10 '14 at 9:02
source share

Ok, I solved this problem with the following steps:

  • At the command prompt, enter DCOMCNFG
  • Expand the console root directory> Component Service> Computers, right-click My Computer, and select Properties
  • Under COM Security> Launch and Activation Permissions, click Change by default.
  • Add user (e.g. IIS_IUSRS) or service
  • Check Allow Local Launch and Local Activation

Then Excel, Word and other applications can work, good luck.

+58
Jul 26 '11 at 16:56
source share

Look in the event viewer under "Windows Logs" on the system machine on which Word is installed. You see a registered event that reads something similar to:

The default permission for the configuration machine does not provide local activation permission for the COM server application with CLSID {148BEE7F-6123-41EE-8CCA-E390902BD0D8} to the user SomeMachine \ SomeUser SID (S-1-5-21-483881670-2168941642-1987552629-1003 ) from the LocalHost address (using LRPC). This permission can be changed using the component services administrative tool.

If so, start DCOMCNFG.EXE and go to "Component Services", "Computers", "My Computer" (or another name), DCOM Config (and you can simply answer "No" if it asks if you want to fix something), and if the event log message for the application, then find it by name in the event log message, here by the name of the element, and if the event log message for CLSID (for example, the example above), find it using CLSID "{ 148B ...} "(this is just a random CLSID I inserted into - maybe it will match your 000209FF ... above) and select e "More Actions ... Properties" on the "Security" tab.

Here you can select [x] Configure and then Modify to add permission for the corresponding user account in order to activate and access the required application or DCOM class.

This is just an assumption, but give a try or something in that direction (i.e. giving access to the CLSID via DCOMCNFG).

+11
Aug 25 '10 at 15:06
source share

I had difficulty with this using the accepted answer because the Microsoft Word 97-2003 Document entry was not included in the DCOM configuration items. I found a solution in this Technet blog post where they correctly explained the problem:

It is important to note that if you are installing 32-bit Microsoft Office on a 64-bit machine, you may need to use the 32-bit DCOM configuration manager to view programs, depending on your operating system.

On x64 operating systems from Windows XP to Windows Server 2008, the 64-bit version of DCOMCNFG.EXE incorrectly configured the 32-bit DCOM for remote activation. This behavior causes components that are designed to be activated remotely; instead, it is activated locally. This behavior does not occur in Windows 7 and Windows Server 2008 R2 and later.

Ref .: http://msdn.microsoft.com/en-us/library/windows/desktop/ms678426(v=vs.85).aspx

It is also suggested that you use the following command line command (instead of DCOMCNFG ) as an effective fix:

 mmc comexp.msc /32 

Which forces you to load the 32-bit DCOM configuration manager instead of the 64-bit one and allows you to follow the steps described in the accepted answer. If this still does not work, the article also explains a number of other possible workarounds.

For more information on this topic, you can also read this post .

+3
May 2 '17 at 11:34
source share

If you cannot find the Microsoft Word application in DCOM

On a 64-bit system with 32-bit Office, try the following:

  • List item
  • Start
  • Run
  • MMS-32
  • File
  • Add Remove Snap
  • Component Services
  • Add
  • Ok
  • Console root
  • Component Services
  • Computers
  • My computer
  • DCOM configuration

after that

  • Search for "Microsoft Word 97 - 2003 Document" (if it is missing, check that your word is also 64-bit (if your Windows))
  • Right click -> Properties
  • Go to the Security tab and edit the Configure radio buttons so that IIS_IUSRS can have launch and access rights.
  • Go to the Identification tab and select "Interactive user" Apply changes and try again.
  • If all this fails, go to the "General" tab and in the "Authentication Level" select "No".
+1
Apr 18 '16 at 16:01
source share



All Articles