I have a ASP.Net framework web application that trying to create a .docx
(or a .pdf
) file from an invoice.
On my local machine, while in development environment, the code does its job fine.
But in production server I had a problem with, accessing IIS_Users to "Microsoft Word 97 - 2003 Document".
I fix that problem by implementing the accepted answer of the following question.
Accessing Office Word object model through asp.net
But now, when I close the remote desktop connection and trying to get file from website, I get error 500 from server and when remote again to server I can download file and my code works fine on the production server.
In other word when RDP is disconnect IIS can't access to "Microsoft Word 97 - 2003 Document".
I think closing RDP causes to log off users and that's why IIS_Users cant access to "Microsoft Word 97 - 2003 Document".
I have also googled this one and didn't find any way to fix it. Is there any way to let user stay signed in even after remote connection gets closed?
while using COM to inteact with word document, you are actually interacting with desktop
after windows 2008, windows service does not support interact with desktop any more, and iis also runs inside svcHost, refer to :https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc756339(v=ws.10)
that's why you can make it work while RDP to your server but failed to get the code run after disconnect from RDP
Edited, the link Provided by Lex Li described in more detail.