Workarounds for exporting Excel exceptions. : System.UnauthorizedAccessException: Failed to retrieve component with CLSID {000209ff-0000-0000-c000-000000000046} in COM class factory

Source: Internet
Author: User

Exception information is: System.UnauthorizedAccessException: Failed to retrieve component of CLSID {000209ff-0000-0000-c000-000000000046} in COM class factory

Find a solution on the Internet

1. In Start, run, enter Dcomcnfg.exe to start the Component Services

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

3: Find "Microsoft Excel application" in "DCOM Config", right-click on it, then click "Properties" to pop Up "Microsoft Excel application Properties" dialog box

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

5: Click on the "Security" tab, click on "Customize" on "Launch and Activation Permissions", then click on the corresponding "edit" button, add a "NETWORK SERVICE" "IUSR" user in the "Security" dialog box (note to select the computer name), give it "local start" and The local activation permission.

6: Remain the "Security" tab, click "Customize" on "Access", then click "Edit" and add a "NETWORK SERVICE" "IUSR" user to the "Security" dialog box that appears, then give "local launch" locally activated permission.

7. Remain the "Security" tab, select Custom on "Configure Permissions", then click "Edit" and add "NETWORK SERVICE" "IUSR" user to the "Security" dialog box, giving Full Control box read access.

But I didn't find the Microsoft Excel application component in the service

It turns out that my system is 64-bit, but the Offic component provides 32-bit to be added before it can be manipulated.

The exact words are:

Because the DCOMCNFG is a 32-bit and configuration that cannot be fully supported under the 64 system, DCOM configuration is required for the WIN2008 X64 system

So the problem is that IIS users do not have the appropriate permissions to the Offic component

The whole process of solving the problem is as follows

  1.1 run : Mmc-32.   
1.2 Select file from the menu (file)->add/remove snap (Add/Remove Snap-in).
add component Services (Component Services), and then after you find Excel under Component Services and configure it, you can see the Microsoft Excel appliction component just like a 32-bit system.
2. Because the user does not have permission to manipulate Excel, you need to authorize Microsoft Excel Appliction by doing the following.
2.1 run: Dcomcnfg.exe 。
2.2 "Component Services"- > Computer-> My Computer-> DCOM configuration, locate the Identity tab, word-> properties, and select Interactive user.
2.3-> Security "Tags", click "Customize" on "Launch and Activation Permissions", then click on the corresponding "edit" button to add a "iis_users" user in the "Security" dialog box (note To select this computer name) and give it "local start" and " Local Activation permission.
2.4-> the "Security" tab, click "Customize" on "Access", then click "Edit" and add a "iis_users" user to the "Security" dialog box that appears, then give "Local access" permission. This allows us to configure DCOM permissions for the corresponding Excel.
If you are  not ready to repeat steps 2.3 and 2.4, add "  NETWORK SERVICE "user
We can solve the problem.

A workaround for exporting an exception in Excel. : System.UnauthorizedAccessException: Failed to retrieve component with CLSID {000209ff-0000-0000-c000-000000000046} in COM class factory

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.