2016-07-22 24 views
0

我們正在推動一箇舊的Windows服務,最初是書面的Windows 2003到Windows 2012 R2服務器進行測試,然而,當我們試圖運行安裝程序的.msi,我們收到以下錯誤:Windows服務安裝錯誤:錯誤1001,無法獲取C: Program Files .. .. xxx.dll程序集中的安裝程序類型程序集。

Error 1001, Unable to get installer types assembly in the C:\Program Files\..\..\xxx.dll assembly. -> . Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. 

看來,它可能是與Oracle.DataAccess DLL的問題:

Oracle Error

日誌查看器提供了這樣的信息:

*** Assembly Binder Log Entry (7/22/2016 @ 1:54:54 PM) *** 

The operation failed. 
Bind result: hr = 0x80070002. The system cannot find the file specified. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\Windows\syswow64\MsiExec.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: DisplayName = Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
(Fully-specified) 
LOG: Appbase = file:///C:/Windows/syswow64/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = MsiExec.exe 
Calling assembly : CTMSRenewalOutboundService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in LoadFrom load context. 
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). 
LOG: No application configuration file found. 
LOG: Using host configuration file: C:\Temp\CFG4155.tmp 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
LOG: GAC Lookup was unsuccessful. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.DLL. 
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\PPD\CTMSOutboundService\Oracle.DataAccess.dll 
LOG: Entering run-from-source setup phase. 
LOG: Assembly Name is: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b). 
ERR: Run-from-source setup phase failed with hr = 0x8007000b. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: All probing URLs attempted and failed. 

*** Assembly Binder Log Entry (7/22/2016 @ 1:54:54 PM) *** 

The operation failed. 
Bind result: hr = 0x80070002. The system cannot find the file specified. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\Windows\syswow64\MsiExec.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: DisplayName = Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
(Fully-specified) 
LOG: Appbase = file:///C:/Windows/syswow64/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = MsiExec.exe 
Calling assembly : CTMSRenewalOutboundService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in LoadFrom load context. 
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). 
LOG: No application configuration file found. 
LOG: Using host configuration file: C:\Temp\CFG4155.tmp 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
LOG: GAC Lookup was unsuccessful. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.DLL. 
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\PPD\CTMSOutboundService\Oracle.DataAccess.dll 
LOG: Entering run-from-source setup phase. 
LOG: Assembly Name is: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b). 
ERR: Run-from-source setup phase failed with hr = 0x8007000b. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: All probing URLs attempted and failed. 

*** Assembly Binder Log Entry (7/22/2016 @ 4:01:10 PM) *** 

The operation failed. 
Bind result: hr = 0x80070002. The system cannot find the file specified. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\Windows\syswow64\MsiExec.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: DisplayName = Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
(Fully-specified) 
LOG: Appbase = file:///C:/Windows/syswow64/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = MsiExec.exe 
Calling assembly : CTMSRenewalOutboundService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in LoadFrom load context. 
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). 
LOG: No application configuration file found. 
LOG: Using host configuration file: C:\Temp\CFGDA59.tmp 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
LOG: GAC Lookup was unsuccessful. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.DLL. 
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\PPD\CTMSOutboundService\Oracle.DataAccess.dll 
LOG: Entering run-from-source setup phase. 
LOG: Assembly Name is: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b). 
ERR: Run-from-source setup phase failed with hr = 0x8007000b. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: All probing URLs attempted and failed. 

*** Assembly Binder Log Entry (7/22/2016 @ 4:01:10 PM) *** 

The operation failed. 
Bind result: hr = 0x80070002. The system cannot find the file specified. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\Windows\syswow64\MsiExec.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: DisplayName = Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
(Fully-specified) 
LOG: Appbase = file:///C:/Windows/syswow64/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = MsiExec.exe 
Calling assembly : CTMSRenewalOutboundService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in LoadFrom load context. 
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). 
LOG: No application configuration file found. 
LOG: Using host configuration file: C:\Temp\CFGDA59.tmp 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
LOG: GAC Lookup was unsuccessful. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Windows/syswow64/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.DLL. 
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\PPD\CTMSOutboundService\Oracle.DataAccess.dll 
LOG: Entering run-from-source setup phase. 
LOG: Assembly Name is: Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342 
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b). 
ERR: Run-from-source setup phase failed with hr = 0x8007000b. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.DLL. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess.EXE. 
LOG: Attempting download of new URL file:///C:/Program Files/PPD/CTMSOutboundService/Oracle.DataAccess/Oracle.DataAccess.EXE. 
LOG: All probing URLs attempted and failed. 

我確信嘗試兩個:

  1. 複製Oracle.DataAccess.DLL
  2. 的本地副本使用的GAC參考的Oracle.DataAccess.DLL

但是他們倆誰也沒上班。

我們已經部署了幾個其他Windows服務引用這個DLL,並沒有問題。

謝謝。

+0

你試過[這個](http://stackoverflow.com/a/1648302/5794617)和[this](http://forums.asp.net/t/2006795.aspx?Could+not+load +文件+或+程序集+文件+或+ + +其+ +依賴關係+ +系統+無法+找到+文件+指定)和[本](http://stackoverflow.com/questions/11030500/ assembly-binding-error-bind-result-hr-0x80070002-the-system-can not-find-the)? –

回答

1

這很可能是一個點位問題,因爲這些鏈接暗示。我要在這裏添加一些額外的信息。

安裝程序集中的安裝程序類不會直接調用。有一個你的MSI首先調用的C++ Dll,它會加載一個.NET運行時版本,然後通過反射實例化你的自定義動作安裝程序類方法(這就是爲什麼你在FusionViewer中看不到你的程序集加載)。在安裝過程中複製本地無關緊要 - 它將加載GAC程序集。除了通過反射實例化之外,您的CA程序集正在從msiexec.exe進程中調用,並且不會加載您擁有的任何配置或設置文件,也不會加載它運行的位置(例如,程序集沒有工作目錄位置)。

Bitness鏈變得複雜 - 您的設置可能是x86或x64,您的自定義操作DLL可能是x86,x64或AnyCpu。它會嘗試加載可能不匹配的依賴項。如果是x86安裝,請爲x86構建安裝程序類,並確保它調用的任何內容都是爲x86構建的。同樣的想法,如果它是64位。所以一個可能的解釋是,Server 2012是64位的,而您的CA程序集正在運行並查找32位Oracle程序集。

1

在與Microsoft支持人員交談後,我們解決此問題的方法是使用Orca重寫在32位.Net框架目錄中引用的InstallUtilLib.dll。

通過使用Orca,我們能夠將msi指向c:\ Windows \ Microsoft.Net \ Framework64目錄。

  1. 打開結果。微星在海怪從Windows安裝程序SDK
  2. 選擇二進制表
  3. 雙擊備案細胞[二進制數據] InstallUtil
  4. 確保「讀取從文件名二進制」被選中,單擊瀏覽按鈕
  5. 瀏覽到%WINDIR%Microsoft.NET \ Framework64 \ v4.0.30319
  6. 選擇InstallUtilLib.dll
  7. 單擊打開按鈕
  8. 單擊確定按鈕

只要我們按照這些步驟,我們就能夠安裝Windows服務。

我們有幾個其他的Windows服務,我們構建並升級到Windows 2012 R2沒有任何問題。出於某種原因,這是唯一需要此解決方法的服務。

希望這可以幫助別人。

謝謝。

相關問題