ASP.Net Com-InterOp Excel Generation issue when hosting
In the end I created user who is admin on the computer with the web service, and then I set this user like shown on the screen below:
That worked. And we didn't have to let the computer be locked.
Microsoft does not recommend or support server-side Automation of the Excel application in a server environment like ASP.NET, see here . Better use Excel package plus (xslx) or Excel library (xls)
The problem is that the 'Identity' set up for the application lacks sufficient privileges. This could be for several reasons, but before we get into those, let's check out where this identity is configured. Open Control Panel, Administrative Tools, and double-click Component Services. Expand COM+ Applications, right-click the application in question, hit Properties, and switch to the Identity tab.
One possible reason is that, when setting the identity for your application, you simply chose a user that doesn't have access to the DLL, or to a file or system call the DLL touches.
If this identity is set to the 'Interactive User', then the above error might occur when the user currently logged in to the machine is a peon, or when nobody is logged in at all. This is the primary reason why this error is never detected in development... the user developing the COM+ application, and in complete control of the machine, is also the user logged in and running as the interactive user.
You should make sure to use a local user account with sufficient privileges, if that's what your DLL requires. User whom uses VPN may find difficulty due to this.
Just set the Identity
to this User and enter the username and password of a user who has sufficient rights. In my case I entered a user of power user group.