ASP.Net Com-InterOp WORD issue after hosting in windows server

Murikkoli, Reshmi 0 Reputation points
2024-09-01T04:45:31.2966667+00:00

I have created an API in C#(.Net framework) to convert Word to PDf using interop.word.dll. I have installed MS Office 2013 on the server. But no one is logged on the server I am getting the below exception

 

"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password. (Exception from HRESULT: 0x8000401A"

 

Does anyone have any solution for this?

Based on the suggestion given Microsoft forum.i have tried the following

In the command line put DCOMCNFG

Component Services -> Computers -> My Computer -> DCOM Config

  1. Find "Microsoft Word 97 - 2003 Document" (If it is missing check if your Word is also 64 bit (if your Windows is) if it is not run mmc comexp.msc /32 instead of DCOMCNFG on step 1

Right click -> Properties

Go To Tab Security and Edit the "Customize" radio buttons so that IIS_IUSRS could have rights for launch and access

Go to Tab Identity and choose "The interactive user"

STILL NO HOPE .

It failed when user logged out from remote connection.

Windows development Internet Information Services
Developer technologies ASP.NET ASP.NET API
Microsoft 365 and Office Word For business Windows
Windows for business Windows Server User experience Other
Microsoft Security Microsoft Identity Manager
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lex Li (Microsoft) 6,037 Reputation points Microsoft Employee
    2024-09-01T07:48:04.5966667+00:00

    Microsoft made it clear that such server side Office automation is not supported,

    https://support.microsoft.com/topic/considerations-for-server-side-automation-of-office-48bcfe93-8a89-47f1-0bce-017433ad79e2

    Thus, you have to follow the advice in that article to switch to one of the feasible options.

    0 comments No comments

  2. AgaveJoe 30,126 Reputation points
    2024-09-01T09:29:38.82+00:00

    Office interop is for building desktop applications. Office interop is not intended or designed for use in web applications. See the following.

    https://support.microsoft.com/en-us/topic/considerations-for-server-side-automation-of-office-48bcfe93-8a89-47f1-0bce-017433ad79e2

    I recommend doing an internet or NuGet search to find a .NET Framework library that meets your needs.

    https://www.nuget.org/packages?q=word+to+pdf

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.