Failed to retrieve a component of the CLSID {00024500-0000-0000-c000-000000000046} in a COM class factory because of the following error: 80070005 "Web client cannot read Excel on server native"

Source: Internet
Author: User
Tags stack trace

Problem Description:. NET cannot read Excel

Symptom: An unhandled exception occurred during the execution of the current WEB request. Check the stack trace information For more information about the error and the source of the error in your code.

Exception Details: system.unauthorizedaccessexception: Retrieving a component in a COM class factory with a CLSID of {00024500-0000-0000-c000-000000000046} failed, The following error occurred because: 80070005.

Cause: When the Web uploads to the server and then reads Excel, the server side will have a problem with C # whether it has permission to use the Excel COM component!

The specific solution is as follows:

1: Install Office Excel software on the server.

2: Enter Dcomcnfg.exe in Start, run, start Component Services

3: Double-click "Computer", "Component Services", "My Computer", "DCOM Configuration"

4: Locate "Microsoft Excel Application" in "DCOM Config", right-click on it, and then click "Properties" to eject "Microsoft Excel should

Using the Program Properties dialog box

5: Click on the "Logo" tab and select "Interactive User"

6: Click on the "Security" tab, click "Customize" on "Launch and Activation Permissions", then click on the corresponding "edit" button to add a "NETWORK SERVICE" user in the "Security" dialog box (note To select this computer name) and give it "local launch" and "Local activation" Permissions.

7: Remain the "Security" tab, click "Customize" on "Access", then click "Edit" and add a "NETWORK SERVICE" user to the "Security" dialog box that appears, then give "Local access" permission. So, We configured the DCOM permissions for the corresponding Excel.

Note: This is configured on WIN2003, on 2000,XP, is to configure the ASPNET user

Because Excel is open on the server, you should write a method that saves the exported data on the server and then passes it to the client, and the last tune

Use this feature to remove any previously generated Excel from the server

=================================================

Workaround Two:

If the above method does not solve the problem, it should be a permission problem, try the following method:

Using identity impersonation in Web. config, add <identity impersonate= "true" username= "Your user name" password= "password" in the <system.web> section/>< /system.web>

=================================================

The first two days under the VS2008 to do a project, using the Excel component is not a problem, but when the project under IIS configuration, browser browsing results are not correct, the internet said with the DCOM component configuration, but I follow the requirements of the match, the result is not.

Later found a way to use it.

Web. config adds a word: "<identity impersonate=" true "username=" OS user "password=" User password "/>", browse ..., the result is correct, Then I looked it up on the Internet, and that's what MSDN says:
1 . Impersonate an IIS authenticated account or user

To impersonate a Microsoft Internet information Services (IIS) authentication user when you receive each request for each page in an ASP. NET application, you must include the <identity> tag in the Web. config file for this application, and the Impe Rsonate Property set to True

2. Impersonate a specific user for all requests for an ASP. to impersonate a specific user for all requests on all pages of an ASP. NET application, you can specify it in the <identity> tag of the Web. config file for the application UserName and Password properties. For example:
<identity impersonate="true" userName="accountname" password="password" />

Personal verification: The final Method 1 can not solve the problem, Law 2 is available--add a user, put in the Administrator user group (with the server All rights) to solve the problem, the hidden danger is that the user rights are too large, and the site security is dangerous.

Reprinted from http://helloouc.blog.163.com/blog/static/5530527120091445046478/ and http://blog.sina.com.cn/s/ Blog_4c6e822d0100hz3m.html, thank you very much.

Failed to retrieve a component of the CLSID {00024500-0000-0000-c000-000000000046} in a COM class factory because of the following error: 80070005 "Web client cannot read Excel on server native"

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.