cognidox / OfficeToPDF

A command line tool to convert Microsoft Office documents to PDFs
https://www.cognidox.com/
Other
609 stars 137 forks source link

RPC Server Unavailable #69

Open suniltandan opened 3 years ago

suniltandan commented 3 years ago

This issue is similar to #13 however this is also happening on export of PowerPoint and Excel.

Windows Version: 10.0.14393 (x64) OfficeToPDF Version: 1.9.0.2

The command is getting run through a script which is running through command line. The error for PowerPoint conversion:

Der Remoteprozeduraufruf ist fehlgeschlagen. (Ausnahme von HRESULT: 0x800706BE) Der RPC-Server ist nicht verf�gbar. (Ausnahme von HRESULT: 0x800706BA) Did not convert

Translated Error would be:

The remote procedure call failed. (Exception from HRESULT: 0x800706BE) The RPC server is not available. (Exception from HRESULT: 0x800706BA) Did not convert

The error for Excel conversion:

Unbehandelte Ausnahme: System.Runtime.InteropServices.COMException: Der RPC-Server ist nicht verf�gbar. (Ausnahme von HRESULT: 0x800706BA) bei Microsoft.Office.Interop.Excel.Workbooks.Close() bei OfficeToPDF.ExcelConverter.Convert(String inputFile, String outputFile, Hashtable options) bei OfficeToPDF.Program.Main(String[] args)

Translated Error:

Unhandled exception: System.Runtime.InteropServices.COMException: The RPC server is not available. (Exception from HRESULT: 0x800706BA) at Microsoft.Office.Interop.Excel.Workbooks.Close () at OfficeToPDF.ExcelConverter.Convert (String inputFile, String outputFile, Hashtable options) at OfficeToPDF.Program.Main (String [] args)

Strangely, this error seems to be resolved when running the script as a service.

Does anyone have idea on why this might be happening?

iamkeyur commented 3 years ago

Create the folder C:\Windows\System32\config\systemprofile\Desktop

If this does not work, try below.

In the command line put DCOMCNFG Component Services -> Computers -> My Computer -> DCOM Config 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 as suggested by Darkseal here) 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" Apply changes and try again If all this fails, go also to tab "General" and in "Authentication Level" drop down choose "None".

suniltandan commented 3 years ago

@iamkeyur thanks for you comment.

Those configurations are indeed necessary to run it as a service and the necessary folders/permissions are already there.

As mentioned on the original post, the call succeeds when the application is running as a service however it fails when running through the command prompt.