Factory recovery of COM classes from CLSID component failed

I developed an application on my pc that does the following: from an upload of a word document, it generates a new document with some basic information. To generate this information it opens the model document, finds a tag that is in this model and replaces it with the content related to each tag (3 in total). On my pc it worked perfectly, however, when I switched to the server, it gets the following error from image.

insert the description of the image here

Detail : below stack trace there is a line that shows the path of my pc project, even if the application is on another computer.

Error text:

Failed to factory retrieve com classes from component with CLSID {000209FF-0000-0000-C000-000000000046} due to the following error: 80070005 Access Denied. (HRESULT exception: 0x80070005 (E_ACCESSDENIED)).

Failed factory recovery of com classes from component with CLSID {000209FF-0000-0000-C000-000000000046} due to the following error: 80070005 Access Denied. (HRESULT exception: 0x80070005 (E_ACCESSDENIED)).

Description: an untreated exception occurred while executing the current Web request. Examine the stack trace for more information about the error and where it originated in the code.

Exception details: System.Authorizedaccessexception: failed factory recovery of com classes from component with CLSID {000209FF-0000-0000-C000-000000000046} due to the following error: 80070005 Access Denied. (HRESULT exception: 0x80070005 (E_ACCESSDENIED)).

O ASP.NET you are not allowed to access the requested resource. It is recommended to grant the request identity of the ASP.NET access rights to the resource. O ASP.NET it has a process-base identity (usually {MACHINE} \ ASPNET in IIS 5 or network service in IIS 6 and IIS 7, and the application pool identity configured in IIS 7.5) which is used if the application is not being represented. If the application is being represented through , the identity is either the anonymous user (usually IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click " Add " to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Author: Leomar de Souza, 2015-03-13

1 answers

Errors similar to this can occur due to the following factors:

  • the lack of DLLs not being registered on the server
  • have not installed Office on the server.
  • the installed Office is 32bit and the server is 64bit

However, if you are sure that everything is correct, you must have stopped configuring something on the server according to these answers from the SOen :

Depending on the oldest answer, follow these steps:

  • In cmd or Win+r type:

    DCOMCNFG
    
  • If your server is in English:

    • Open Root Console > Component Service > Computers

    • Right-Click My Computer and select Properties

    • Go to the tab with Security > Launch and Activation permissions and click Edit Default

  • If your server is in English:

    • Open control Root > component services > Compurators

    • Right-Click my computer and select properties

  • Go to the Security tab with > start and enable permissions and click edit default...

  • Click the Add button (Add if it is English) and type in the text field IIS_IUSRS for example or add a service, it should be something like:

    insert the description of the image here

    1. Note: O IIS_IUSRS is a group of IIS users

    2. Note: in Windows server 2003 the group is IIS_WPG

  • Click Ok, but do not close the next screen

  • In this remaining window check the options, as in the image:

    insert the description of the image here

  • Then just click Ok in the following Windows and close whatever is necessary, so it should work.

I'm editing the question as I'm still testing


According to the most recent answer:

Apparently as these steps you will only release access to the desired specific COM, however be careful, do only what is requested here:

  • In cmd or Win+r type:

    DCOMCNFG
    
  • If your server is in English:

    • open Root Console > Component Service > Computers > DCOM Config
  • If your server is in English:

    • open control Root > Component Services > Compurators > Config DCOM
  • Search for the component for example Microsoft Word 97 - 2003 Document and right-click and go to properties, for example:

    insert the description of the image here

    If the desired component is not listed it is because you are with the x86 version of Office and your operating system is 64bit, or because you do not have office installed or properly registered components

  • Go to the Security tab

  • In the areas startup and activation permissions and access permission add the user IIS_IUSRS and the permissions.

  • Then click Ok

 7
Author: Guilherme Nascimento, 2017-05-23 12:37:31