Word Component in C#

做~自己de王妃 提交于 2019-12-13 04:42:01

问题


I am using component of Microsoft.Office.Interop.Word.dll on C#.But when i run it on IIS,I am receiving the following error.

Retrieving the COM class factory for component with 
CLSID {000209FF-0000-0000-C000-000000000046} failed 
due to the following error: 80070005.

if I allow 32-bit applications on IIS,I am receiving the following error.

”Validation of viewstate MAC failed. If this application is 
hosted by a Web Farm or cluster, 
ensure that <machineKey> configuration specifies the 
same validationKey and validation algorithm.
AutoGenerate cannot be used in a cluster”

I am entering the following line into web.config file.

<system.windows.forms jitDebugging="true"/>  

if I run again , that's gives me error.

Microsoft Word encountered a problem.

Description: An unhandled exception occurred during the execution
of the current web    request. Please review the 
stack trace for more information about the error and 
where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: 
Word encountered a problem.

Source Error:

Line 711:
Line 712:        //ADDING A NEW DOCUMENT TO THE APPLICATION
Line 713:        oWordDoc = oWord.Documents.Add(ref yol, ref oMissing, 
ref oFalse, ref   oTrue);
Line 714:
Line 715:        // SELECT END

By the way, I am using IIS 7 64-bit on Windows Server 2008.

How can i solve this problem?

Thanks in advance.


回答1:


Error (or HRESULT) 0x80070005 translates to E_ACCESSDENIED which means you've got a permissions problem somewhere.

Make sure your web site's identity has permissions to access Word.

Also make sure your application pool's enable32BitOppOnWin64 setting is configured to match whatever processor architecture your Word app is targeted at.



来源:https://stackoverflow.com/questions/5700726/word-component-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!