Asp. NET operations IIS permission settings for Word

Source: Internet
Author: User
Tags add object config iis net
Asp. NET account does not have permission to manipulate Microsoft Office objects by default, and if no permissions are configured, the code throws an exception that resembles the following:

Retrieving a component with a CLSID of {00024500-0000-0000-c000-000000000046} in a COM class factory failed because the following error occurred: 80070005.

This poses a certain difficulty for ASP.net to manipulate Microsoft Office objects. But we still have to figure out how to do Office objects. Here is a brief introduction of the methods I have used in the development process:

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

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

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

Method 2: In the DCOM configuration, configure the permissions for the IIS account to work with Word (as do other Office objects).

Specifically: Component Services (Component service)-> computer (Computers)-> My Computer (my Computer)->dcom configuration (DCOM Config)->microsoft Office Word 97-2003 Document, right-click Microsoft Office Word 97-2003 document, and choose Properties for two steps:

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

(2) On the Security tab, select Custom (Customer) for the first two groups (start and Activate permissions, access rights), and then click Edit to add the IIS account in the pop-up interface (the server version of the operating system is typically network SERVICES, other systems (XP) may be asp.net, and in the following permission box, assign all permissions to the user.

Method 3: Assign a local account to the ASP.net site application pool

How to: 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 accounts.

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

Of the above three methods, individuals prefer the third, because after the Word object is finished, the Word object's process needs to be closed, and the third method can leave the ASP.net application with permission to end the word process without other settings.

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.