An error occurred while running Excel everywhere after Asp.net was published to IIS. problem resolution record

Source: Internet
Author: User
Tags asp net microsoft access database

Recently, I started to specialize in web development. I always encountered some strange problems. Now I want to write one of them (I know little about iis and need to improve my understanding)

C # an excel Export program written in C # has been published to iis, and an error occurs. I found out the problem today. The specific solution is as follows: (Excerpted from net and tested by myself)

Article 1: retrieving components whose CLSID is {00024500-0000-0000-C000-000000000046} in the COM class factory fails because of the following error: 80070005. The solution 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 "Microsoft Excel application" in "DCOM configuration ", 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. in this way, we have configured the corresponding Excel DCOM permissions. note: This is configured on WIN2003. On 2000, it may be because the ASP net user is configured to open the EXCEL file on the server. Therefore, you should write a file to save the exported data to the server, then pass the method to the client, and delete all the Excel files generated on the server each time this function is called.

Article 2: An error occurred when creating an EXCEL application:

Failed to retrieve components whose CLSID is {00024500-0000-0000-C000-000000000046} in the COM class factory because of the following error: 80070005

Solution: configure the EXCEL application in DCOM:

To set up an Office Automation server under an interactive user account, follow these steps:

1. Log on to your computer as an administrator and use the full installation method to install (or reinstall) The Office. 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 that you want 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. ClickStart, ClickRunAnd 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

ClickAttributeOpen the Properties dialog box for this application.

6. ClickSecurityTab. VerifyUse the default access permissionAndUse the default start permissionSelected.
7. ClickIdentifierTab, and then selectInteractive User.
8. ClickOKTo close the Properties dialog box and return to the main Application List dialog box.
9. InDCOM ConfigurationIn the dialog box, clickDefault SecurityTab.
10. ClickEdit Default Value. 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, and then clickOK.
12. ClickEdit Default Value. 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, and then clickOK.
14. ClickOKDisable dcomcnfg.

Article 3: A web program needs to operate the Excel file. In the development environment, the program test is normal. After being deployed to IIS, the program operates the Excel file. IIS reports an error. The IIS prompt message is as follows: When retrieving components whose CLSID is {00024500-0000-0000-C000-000000000046} in the COM class factory, the failure occurs because of the following error: 80070005.Note:An error occurred while executing the current Web request. Check the stack trace information for details about the error and the source of the error in the code.

Exception details:System. UnauthorizedAccessException: When retrieving components whose CLSID is {00024500-0000-0000-C000-000000000046} in the COM class factory, the error 80070005 is returned.

ASP. NET is not authorized to access the requested resources. Consider granting the ASP. NET Request identity the permission to access this resource. ASP. NET has a base process ID that is used when the application is not simulated (usually {MACHINE}/ASPNET on IIS 5 and Network Service on IIS 6 ). If the application is simulating through <identity impersonate = "true"/>, the identity will be an anonymous user (usually IUSR_MACHINENAME) or an authenticated user.

To grant ASP. NET access permissions to a file, right-click the file in resource manager, select "properties", and select the "Security" tab. Click Add to add an appropriate user or group. Highlight the ASP. NET account and select the corresponding access permission box. -- Asp.. Net runtime permission is insufficient. Solution: 1. Use a simulated account and add <! Identity impersonate = "true" userName = "administrator" password = "*******"/> 2. In the DCOM component service. the EXCEL component is assigned to ASP. (1) Open the run dialog box of the Start Menu, enter the dcomcnfg command, and click OK. The component service window is displayed. (2) expand computer> my computer> DCOM configuration, find the Microsoft Excel application node (3), right-click, and select "security, select "Custom" for each of the following three items, and click the edit button (4) in the launch permission dialog box, click the Add button to add the corresponding user (Note: if it is WIN2000, XP, add the "machine name/ASPNET" user. Here we use WIN2003 as an example, WIN2003 is to add a "NETWORK Service" user), and grant the maximum permission

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.