2011-04-18 16 views
0

我在C#中使用Microsoft.Office.Interop.Word.dll的組件。但是當我在IIS上運行它時,出現以下錯誤。C#中的Word組件

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

如果我在IIS上允許32位應用程序,我收到以下錯誤。

」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」 

我在web.config文件中輸入以下行。

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

如果我再次運行,這是給我的錯誤。

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 

順便說一句,我使用IIS 7的Windows服務器上的64位2008年

我怎樣才能解決這個問題?

在此先感謝。

+0

有什麼建議嗎? – Arbelac 2011-04-18 20:46:23

+0

在服務器上安裝了Word/Office嗎? – Kev 2011-04-18 20:50:52

+0

@ Kev- yes.it已安裝。 – Arbelac 2011-04-18 20:53:30

回答

0

錯誤(或HRESULT)0x80070005轉換爲E_ACCESSDENIED這意味着您在某處存在權限問題。

確保您的網站身份有權訪問Word。

還要確保您的應用程序池的enable32BitOppOnWin64設置配置爲匹配您的Word應用程序所針對的任何處理器體系結構。