. Net Excel export 80070005 error solution:
An error occurred while retrieving components whose CLSID is {00024500-0000-0000-c000-0000000000000046} in the com class factory because the following error occurs: 80070005. net exports excel. File , You need to configure it like this. If it is not configured, it is correct, and there should be no error after configuration.
The configuration method is as follows:
1: Install the Excel software for office on the server.
2: Enter dcomcnfg.exe in "start"-> "run" to start "Component Service"
3: Double-click "component service"> "computer"> "my computer"> "DCOM configuration"
4: Find the Microsoft Excel application in "DCOM configuration ". Program ", Right-click it, and then click" properties ". The" Microsoft Excel application properties "dialog box is displayed.
5. Click the "ID" tab and select "Interactive User"
6. Click the "Security" tab, click "Custom" on "Start and activate Permissions", and then click the corresponding "edit" button, in the pop-up "security" dialog box, add a "Network Service" user (note that you must select the computer name) and grant it the "local start" and "Local activation" permissions.
7: the "Security" label remains. Click "Custom" on "Access Permissions", and then click "edit ", in the pop-up "security" dialog box, add a "Network Service" user and grant "local access" permission.
8. If the error 8000401a occurs after the interactive user is set, you can cancel the interactive user and set it to administratr. This problem can be solved temporarily. Further solutions are to be discussed.
9. After setting, "object reference or link cannot be used" may appear when you open an Excel file, and cell pasting is not allowed. The reason is unknown. The setting will disappear after cancellation.
Note: simply following the above settings does not completely guarantee that no problem exists, because calling office operations may involve other system resources and may still cause problems due to insufficient permissions, after setting the Excel application, the system may still report a 80070005 error. The most safe thing is to select my computer in dcomcnfg and right-click the property-> com security, edit the default access permissions, start and activation permissions, and add network service (Asp.net user is required for IIS 5.0 ), in addition, if you set the same permissions for networkservice, you can basically ensure that no problem occurs.
This is the basic method, but I have also encountered errors when using the above methods, my environment is Windows2003 + office2003 + office2007, which can be exported on the test server without any problems! However, if the official environment is updated, an error is returned. If permissions are set, an error is returned. Because my test server is started by the default Office, I suspect it is a problem with the office environment! So I uninstalled office2007 and immediately tested it. But after I restarted the server, the have not been pre-compiled error occurred, and the export page could not be opened, so I re-installed office2007 and opened the page, but an error was reported when exporting the Excel file! I reset all the permissions again. the problem persists! Later, I found that the Excel programs opened by the two servers are different by default. The test environment is opened by office2003 by default, and the official environment is opened by office2007. So I re-registered office2003 in the official environment, so that it is also the default office2003 open program, rely on! The problem is finally solved !!!
Register Method execution start ---- run ---- enter the installation path of excel2003, for example, "C: \ Program Files \ Microsoft Office \ office11 \ excel.exe "/regserver note/there is a space in front of the symbol, where" C: \ Program Files \ Microsoft Office \ office11 \ excel.exe "is the path of the installation program of excel2003. The regserver parameter indicates registration!
after running, the installation program of Office 2003 is started, repaired, and registered again.
excel2007 is the same as the default method for starting a program. You can execute start ---- run ---- "D: \ Program Files \ Microsoft Office \ office12 \ excel.exe "/regserver
In summary, when you encounter an Excel export or import problem, consider the permission issue first, consider the Office version environment again! This can basically solve these problems.