今天在處理一個很久沒經手的專案,結果在設立執行環境時 ( Win7 x64 + IIS7 ) 卻遇到了無法載入組件的錯誤訊息 ( Could not load file or assembly 'Interop.ActiveDs' or one of its dependencies. An attempt was made to load a program with an incorrect format. ) 其中文錯誤訊息為 "無法載入檔案或組件 ‘'Interop.ActiveDs' 或其相依性的其中之一。 系統找不到指定的檔案。" ,雖然這個問題之前遇到過,不過由於久沒處理過這個案子,忘記了這個案子有用到 32 位元的 COM 元件,因此必須要設定 IIS7 的應用程式集區才能讓網站正常載入 COM 組件並正常執行。
修正方式也很容易,只要在執行該網站的應用程式集區 (Application Pool) 的 [進階設定] 中將 啟用 32 位元應用程式 項目設定為 True 即可。

中文版的參考設定畫面如下:

相關連結