Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows Server 系統教學 >> Server 2008

Windows Server 2008 64位系統無法使用 Office Interop Excel 組件的解決方案

編輯:Server 2008

問題現象

64 位 Windows Server 2008 上,ASP.NET 應用呼叫 Microsoft.Office.Interop.Excel 時拋出錯誤:
檢索 COM 類工廠中 CLSID 為 {00024500-0000-0000-C000-000000000046} 的組件時失敗。

根本原因

64 位系統下,預設的 dcomcnfg.exe 是 64 位版本,無法顯示 32 位的 Office COM 元件(如 Microsoft Excel Application),導致無法配置 DCOM 權限。

解決步驟

1. 開啟 32 位元件服務管理單元

  1. 執行 mmc -32 開啟 32 位主控台。
  2. 「檔案」→「新增/移除管理單元」→ 選擇「元件服務」→ 新增 → 確定。
  3. 在主控台樹狀結構中即可看到「DCOM 設定」下的「Microsoft Excel Application」。

2. 配置 DCOM 權限 (針對 Microsoft Excel Application)

  • 識別標籤:選擇「互動式使用者」。
  • 安全性標籤 → 啟動與啟用權限:自訂 → 編輯 → 新增 NETWORK SERVICE(選擇本機電腦)→ 賦予「本機啟動」與「本機啟用」權限。
  • 安全性標籤 → 存取權限:自訂 → 編輯 → 新增 NETWORK SERVICE → 賦予「本機存取」權限。

3. 設定 IIS 應用程式集區身分識別

在 IIS 管理員中,將該網站對應的應用程式集區 Advanced Settings → Identity 設為 LocalSystem 或 NetworkService,確保具有足夠權限啟動 Excel COM 物件。

完成上述步驟後,64 位 Server 2008 即可正常透過 Office Interop 操作 Excel。

Copyright © Windows教程網 All Rights Reserved