Some time ago, a problem occurred while maintaining the company's previous projects. The customer needs to add a Word document merging function. It is reasonable to say that this function is better implemented, as long as the COM component that comes with the office is called, however, this is not the case. If an error is reported after the client is deployed, the following message is displayed ):
Retrieving the com class factory for component with clsid {000209ff-0000-0000-c000-000000000046} failed due to the following error: 80070005.
SearchComWhen the component whose CLSID is {000209ff-0000-0000-c000-000000000046} in the class factory fails, the following error occurs:80070005
The solution is as follows:
1: Install office software 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. In "DCOM configuration", find "Microsoft Word application", right-click it, and click "properties". The "Microsoft Word 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.
Well, it really didn't solve my problem. I went on to find out and thought that the method of adding identity was more reliable. So I added the following configuration under the system. Web tag in Web. config:
- <Identity impersonate = "true" username = "current user name" Password = "current password"/>
Run the program again and execute it perfectly. I thought it was okay. But who once thought there was another problem with the crystal report? after Google again, I realized that the original identity conflicts with the crystal report, he meowed me a piece of attention, and this identity is not added with duteweide ah, calm down and think about it carefully, since the word function is easy to use after adding identity, it should be about permissions.
Isn't itNetworkServiceIsn't the permission public enough? Delete the "Identity" section first. In the "Microsoft Word application attributes"In the dialog boxStart and activate permissions,Access permissionAll the privileges of the Everyone group are added. The problem persists ~! Alas.
As the heap of COM components turned around, suddenly the name of a COM component came into view, "Microsoft Office Word 2007 enable macro documentation". It was a dead horse, and it was also followed by word, add the everyone permission and test again. No problem. It's strange to recall everyone and return it to the current user.
(I checked the Microsoft documentation. It was originally related to the development environment. In my development environment, the target client of office 2010 is Office 2003)
To sum up the solution, follow the steps 1-7 in the previous step, but you must Configure permissions for both the Microsoft Word application and the Microsoft Office Word 2007 macro-enabled documents, if the network service permission still does not work, you can add the everyone permission and then narrow down the permission until the minimum permission is found.
Solve COM component 80070005 Error