Some time ago, I used Excel and Word programming for development. I used the 2003 system and the development environment was VS2008 and Office2007. There was no problem in the test, however, some headaches occur during deployment. For example, the component whose CLSID is {000209FF-0000-0000-C000-000000000046} in the COM class factory fails to be retrieved because of the following error: 8000401a. .
I have found a lot of information on the Internet, most of which are two solutions:
1. Add the virtual permission on the web. the key value added in config. The windowsloginid must have the Administrator permission. This method is feasible after use, but it is not conducive to deployment, because experienced users know what the consequences of displaying the password of a server account with the highest permissions on the configuration file are. Therefore, this solution is not feasible. The second solution is involved.
2. Add the interactive access permission of the Com component: this is also the method with the highest search rate on the Internet. Run "DCOMCNFG ", find the Microsoft Excel 97/2000/2002-Microsoft Excel application Microsoft Word 2000/2002-Microsoft Word Document
For more information about the interactive access permissions of these components, see: http://support.microsoft.com/kb/288366, this solution should be feasible, but I have tried on a server on my own machine many times, finally, I tried to use a specific user for access. If it is subdivided, this is the third solution. ^_^
3. added access permissions for specific users of the Com component. This is the focus of my speech today. It is also a solution that helps me solve practical problems. In short, we can do this: Create a required account (such as test ), the permission is Power User or User. Use this account to run word or excel once (ensure that you have access permission); run DCOMCNFG, in the Dcom component, find the Microsoft Excel application or Microsoft Word Document (same as the previous one)-properties-icon and select "specific user ", then, enter the account and password you created to add the component access permission. In some machines, you also need to add the Enable and access permissions for this account in the preceding Security labels. of course, it is also feasible to directly use your own login account
4. The ultimate solution is to combine article 3 with article 1 and correspond to users. Effect 100%
Use identity simulation in web. config, add in the <system. web> section: use identity simulation in web. config, and add in the <system. web> section:
<Identity impersonate = "true" userName = "your userName" password = "password"/>