Reference Document: Http://www.cnblogs.com/wolf-sun/p/3574278.html
I chose the scenario: Generate a PDF with an Office COM component first, and then preview the PDF document online using Pdf.js. In the process of writing a demo of the following two questions, in this record, I hope to help the brothers and sisters who encounter similar problems.
1. When you install Office Plus 2010 on a server, a permission error occurs when you use its COM component to generate a PDF
System.UnauthorizedAccessException:Retrieving the COM class factory for component with CLSID { 000209ff-0000-0000-c000-000000000046} failed due to the following error:80070005 Access is denied. (Exception from hresult:0x80070005 (e_accessdenied)).
The workarounds are:
1. Configuring the identity in Web. config
<system.web>
<authentication mode= "Forms" >
<forms name= "_authuserkey" cookieless= "usecookies" protection= "All" path= "/" Loginurl= "~/account/login" Defaulturl= "~/website/home/index" >
</forms>
</authentication>
<authorization>
<deny users= "?"/>
</authorization>
<identity impersonate= "true" Username= "Wdeploy" password= "123"/>
2. Configuring DCOM
Control Panel-"Management tools-" Component Services-"computer-" My Computer-"DCOM config-" found Microsoft Word document
After
Click Properties to open the Properties dialog box for this application.
2. Click the Identity tab and select Interactive User.
3. Click the Security tab, select Custom in the launch and activation permissions and access permissions groups, and then
Add an ASP. NET account and IUSER_ computer name, customize---Edit
* These accounts exist only if IIS is installed on the computer.
4. Make sure that each user is allowed access, and then click OK.
5. Click OK to close the DCOMCNFG.
If you do not see Microsoft Offfice Word in Component Services, you will need to reinstall Office.
2.WORD Application.Documents.Open function returns null for a workaround
DCOM config Setting for "Microsoft Office Word 97-2003 Document" Internal configuration is OK, but calling the Application.Documents.Open function or returning null. Here's a workaround:
Create a "Desktop" directory under the "C:\Windows\SysWOW64\config\systemprofile\" directory.
About the requirements processing method for online preview word,excel,ppt,pdf.