Asp. Net operating IIS permissions configuration for Word

Source: Internet
Author: User

Asp. NET accounts, by default, do not have permissions to manipulate Microsoft Office objects, and if you do not configure permissions, the code throws an exception that resembles the following:

Failed to retrieve a component of the CLSID {00024500-0000-0000-c000-000000000046} in a COM class factory because of the following error: 80070005.

This poses some difficulties for the Microsoft Office objects that are operating in ASP. But we still have to find a way to work with Office objects. Here is a brief introduction of my development process has been used in the method:

Method 1: Configure the Web. config file to impersonate the local system's account on each request.

Action: Add the following node in the Web. config file:

<identity impersonate= "true" Username= "AccountName" password= "password"/>
Where: Username is the local account to be simulated, password is the password of the account.

Method 2: In DCOM configuration, configure the permissions for the IIS account to manipulate word (as well as other Office objects).

What to do: "Component Services (Component service)", Computer (Computers), My Computer (My Computer)->dcom configuration (DCOM Config)->microsoft Office Word 97-2003 document, right-click the Microsoft Office Word 97-2003 Document, and then select Properties to do two steps:

(1) On the Identity tab, select Interactive Users (the interactive user).

(2) In the Security tab, for the first two groups (launch and activation permissions, access rights) Select "Custom (Customer)", then click "Edit" to add the IIS account in the popup interface (the server version of the operating system is generally network SERVICES, other systems (XP) may be ASP., and in the Permissions box below, assign all permissions to the user.

Method 3: Assign a local account to the ASP. NET site Application pool

Action: In IIS, create a new application pool for the ASP. NET site, and then change the Identity tab of the application pool properties to select Local System (LocalSystem) for the predefined account.

If it is in IIS7.0, follow these steps: Create a new application pool for the ASP. Select the application pool, advanced settings, Process mode, identity: Select LocalSystem.

Of the above three methods, individuals prefer to use a third, because after the Word object is finished, you also need to close the Word object's process, and the third method can not have other settings to allow the ASP. NET application has permission to end the word process.

Asp. Net operating IIS permissions configuration for Word

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.