ASP.Net Com-InterOp Excel Generation issue when ho

2020-08-13 05:57发布

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.

9条回答
我欲成王,谁敢阻挡
2楼-- · 2020-08-13 06:20

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.

查看更多
甜甜的少女心
3楼-- · 2020-08-13 06:31

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)

查看更多
该账号已被封号
4楼-- · 2020-08-13 06:32

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:

enter image description here

That worked. And we didn't have to let the computer be locked.

查看更多
登录 后发表回答