ASP.NET Com-InterOp Excel issue when hosting

In my ASP.Net application, I create an Excel file using the MsExcel Object Libby (Com-InterOp). The application worked fine in VS dev. Environment.

But when I host it on the server, I get the following error if I am not registered on the server through a remote desktop connection.

"Fetching the factory COM class for a component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not start because the configured authentication is incorrect. Username and password. (Exception from HRESULT : 0x8000401A).

I also installed DCOM configurations. The strange thing is that at least one user must be connected to the server via RDC. If so, then anyone can generate excels. If not above the error throws. The rest of the functionality of the application works fine.

Server is Windows Server 2008, IIS7. And users connecting the application via VPN.

Has anyone experienced such a problem?

Thanks in advance.

+6
source share
8 answers

Thank you for @ Rofans.Net, in accordance with the points provided by us, we determined that the server on which the application was located was located in a third-party data center, and the server did not always have access to the server. RDC users are registered users only.

Thus, we were able to enter all the user’s paths and put the computer in a locked state, so that all methods of logging in to the system.

This is the only way we have found, and if anyone finds a better way, add it.

Thanks.

-2
source

In the end, I created a user who is the administrator on the computer with the web service, and then I installed this user as shown on the screen below:

enter image description here

It worked. And we did not need to lock the computer.

+8
source

The problem is that the Identity installed for the application lacks sufficient privileges. This may be for several reasons, but before we get into these issues, let's see where this identity is configured. Open Control Panel, Administrative Tools, and double-click Component Services. Expand COM + Applications, right-click the appropriate application, click Properties and select the Identification tab.

One possible reason is that when setting up an identifier for your application, you simply select a user who does not have access to the DLL, or to a file or system call regarding the DLL.

If Interactive User is set for this identifier, the above error can occur when the user who is currently logged on to the computer is peon or when no one is logged in at all. This is the main reason why this error is never detected during the development process ... the user developing the COM + application and fully controlling the work with the machine is also a user who logs into the system and works as an interactive user.

You must ensure that you are using a local user account with sufficient rights if your DLL requires it. A user who uses a VPN may encounter difficulties because of this.

+4
source

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 that prevent the Windows service (IIS is just a special case) from doing “desktop” things ... which means you have to work around a few security measures (impersonation in itself won't cut it!) to make it work (NOT recommended!).

NOTE that the Integrated VS web server does not model IIS permissions behavior, etc.

There are several options for working with Excel in a server-side script (free and commercial):

I can recommend Aspose.Cells and Flexcel ... have not tried SpreadsheetGear , but heard + read a lot of good things about this.

Free parameters (although for xlsx format only!) Are, for example, OpenXML 2 from MS and EPPlus .

+3
source

Microsoft does not recommend or do not support server-side automation of an Excel application in a server environment such as ASP.NET, see here . Better to use Excel Plus (xslx) or Excel Library (XLS)

+2
source

Simply set Identity this user and enter the username and password of a user with sufficient rights. In my case, I entered the user group of users.

+2
source

I did a study on this issue, which I also had. I did this: http://forums.asp.net/t/1093228.aspx

I don’t know how good it is, but it works. :)

Enter dcomcnfg in cmd

go to Component Services → My Computer → Traveling Salesman Security → Lauch and Activate Permissions → Change Default → Add ...

Now add Network Service and allow all its permissions.

0
source

I have the same situation when you try to read the downloaded Excel file. Try these steps. This works for me.

  • Create a local account (set password and tick never expired)
  • Add the created account in step 1 to the IIS_IUSRS group
  • Change web configuration ...
  • Log out and try.

Hope this is helpful for you.

0
source

Source: https://habr.com/ru/post/907391/


All Articles