Excel export problem: failed to retrieve components whose CLSID is {00024500-0000-0000-c000-000000000046} in COM class factory. Error: 8000401a
During the seven-day holiday of the National Day, I did not go out to stay at home. At that time, my wife was engaged in a lottery system. She didn't really want to do it, and I had nothing to do, so I was idle and idle, I did it three days later, with an Excel export function.
At that time, there was no problem during local testing, but when uploading to the server, the component whose CLSID is {00024500-0000-0000-c000-0000000000000046} in the com class factory failed to be retrieved. Error: 8000401a.
I searched the internet and read a lot of solutions. Many solutions were not solved, but they were solved by combining multiple solutions. So I summarized the solution. The solution is as follows:
Set the parameters as follows:
Configure the Excel application in DCOM Program :
To set up an Office Automation server under an interactive user account, follow these steps:
1. log on to the computer as an administrator and install (or reinstall) The office using full installation. To ensure system reliability, we recommend that you copy the content from the office CD-ROM to your local drive and install office from this location.
2. Start the Office application to run automatically. This forces the application to register itself.
3. After running the application, press Alt + F11 to load the Microsoft Visual Basic for Applications (VBA) Editor. This forces VBA to initialize.
4. Close the application, including VBA.
5. Click Start, click run, and then type dcomcnfg. Select the application to run automatically. The Application name is as follows:
Microsoft Access 97-Microsoft Access database
Microsoft Access 2000/2002-Microsoft Access Application
Microsoft Excel 97/2000/2002-Microsoft Excel application
Microsoft Word 97-Microsoft Word basic
Microsoft Word 2000/2002-Microsoft Word documentation
Click properties to open the Properties dialog box for this application.
6. Click the Security tab. Verify that the default access permission and the default start permission are selected.
7. Click the ID tab and select an interactive user.
8. Click OK to close the Properties dialog box and return to the main Application List dialog box.
9. In the DCOM configuration dialog box, click the Default Security tab.
10. Click Edit default value for access permission. Verify that the following users are listed in the access permission. If not, add these users:
System
Interactive
Everyone
Administrators
IUSR _ <machinename> *
IWAM _ <machinename> *
* These accounts only exist when Internet Information Server (IIS) is installed on the computer.
11. Make sure that each user is allowed to access the service and click OK.
12. Click Edit default value for the startup permission. Verify that the following users are listed in the startup permission. If not, add these users:
System
Interactive
Everyone
Administrators
IUSR _ <machinename> *
IWAM _ <machinename> *
* These accounts only exist when IIS is installed on the computer.
13. Make sure that each user is allowed to access the service and click OK.
14. Click OK to disable dcomcnfg.
If you have used identity simulation (<identity impersonate = "true"/> configured in Web. config), you need to delete it !...
The last two steps are required:
1. Update and install the Office and install the. NET programmable component on the local machine (Excel component)
2. Replace the interactive user with "start user"