Accessing LibreOffice From IIS 10 Hangs on bootstrap

I have a VB.Net application that opens an ODT file, performs a number of replace operations then saves it as a PDF. When I try to use the same code under IIS 10 as a web service the call to bootstrap does not return. Process Explorer shows that soffice.exe and office.bin are in memory. I have to kill the two processes to continue.

I’ve tried various suggestions related to compiling the application in 32 bit or telling IIS to allow 32 bit applications. Those only produce other errors. I’m using the 4.6.2 dot net framework and the x64 version of LibreOffice and SDK. I’m running Windows 7 on my development machine and have gotten the same results on Windows Server 2019.

What do I need?

To answer my question “What do I need?”, I need a drink. This was horrible. The amount of searching and fiddling required to find out how to run the Libre API deserves an award if you can get it to work. The problems were several.

Libre needs to be initialized. It has a first start wizard. That’s what I think made it not work when running under a different user within IIS. To overcome that required starting soffice.exe with a process where arguments could be provided. Also figuring out which paths need to be forward slashes and which ones need to be back slashes and when to prefix the path with “file:///” was frustrating. It appeared that using pipes was the wrong communication method to connect to the running process. Some errors could only be seen when running outside of IIS. In that environment a command box would pop showing the error. There are so many different versions and kinds of open office that any online help for starting soffice.exe was confusing. In one case prefixing the parameter with 2 dashes threw an error. In other cases it didn’t seem to make a difference. Once I got a list of parameters from the command line call to my version soffice.exe things got a little better.

I want to post a simple example of how this worked for me on IIS 10 using MVC and VB.Net but using the exact same calls I can’t get it to work. I’ve combed through it for an hour and can’t find the difference. It’s a house of cards.