In my ASP.Net application I'm generating a Excel file using MsExcel Object Libby (Com-InterOp) . The application worked fine in the VS dev. environment.
But when I host it in the server I'm getting following error, if I'm no user is logged in to the server through Remote desktop Connection.
"Retrieving the COM class factory for component with CLSID {00024500-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)."
I've set DCOM configurations as well. The strange thing is that at least one user should be connected to the server through RDC. If so everyone can generate excels. If not above error throws. Rest of the functionality of the application works fine.
The server is Windows Server 2008, IIS7. And the users connecting the application through a VPN.
Has any one experienced a issue like this?
Thanks in advance.
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.
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.
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)
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.
Using Office Interop on the server is NOT supported by MS - see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
Since Windows Vista MS introduced several security-related measures which prevent a Windows Service (IIS is just a special case of that) from doing "desktop-like" things... which means you would have to circumvent several security measures (impersonation alone won't cut it!) to get it to work (NOT recommended!).
NOTE that the Integrated VS web server does NOT simulate the behaviour of IIS regarding permissions etc.
To deal with Excel in a server-scenario there are several options (free and commercial) out there:
I can recommend Aspose.Cells and Flexcel... didn't try SpreadsheetGear but hear+read lots of good things about it.
Free options (though for xlsx format only!) are for example OpenXML 2 from MS and EPPlus.
I made research on this problem, which I also had. I did that: http://forums.asp.net/t/1093228.aspx
I don't know how good solution it is but it works. :)
Type dcomcnfg in cmd
go to Component Services ->My Computer ->Com Security ->Lauch and Activate Permissions ->Edit Default ->Add...
Now add Network Service and allow all permisions to it.
I have the same situation when try to read an uploaded Excel file. Let try these steps. It works for me.
Hope it is helpful for you.
Just create a new user on the machine with admin privilege and assign this user on the Identity Tab
of the COM service
as per the below image. It works perfectly.
Thanks for @Rofans.Net, based on the points provided by him we identified that the server, which the app was hosted was in a 3rd party data center and there is no user logged on to the server all the time. Only logged on users are the RDC users.
So we managed to have a user all ways logged in and and put the computer in the locked stated so that all ways it has a logged in user.
This is the only way we found and if anyone found a better way please add.
Thanks.
User contributions licensed under CC BY-SA 3.0