2012-10-31 42 views
4

我正在使用Windows 7 x64。當啓動一個MVC應用程序時,我得到一個BadImageFormatException。如果它在啓用了32位應用程序的應用程序池中運行,則不會拋出異常。它看起來像加載global.asax是問題。我啓用了融合日誌記錄(HKLM \ software \ Microsft \ Fusion!EnableLog)註冊表設置。這是日誌:x64上的IIS中的BadImageFormatException

=== Pre-bind state information === 
LOG: User = NT AUTHORITY\SYSTEM 
LOG: Where-ref bind. Location = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\spl.sim.mvc\5802065c\a2782d40\App_global.asax.olejmmua.dll 
LOG: Appbase = file:///C:/Spl/SimSvn4.5/Source/Spl.Sim.Mvc/ 
LOG: Initial PrivatePath = C:\Spl\SimSvn4.5\Source\Spl.Sim.Mvc\bin 
Calling assembly : (Unknown). 
=== 
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: Using application configuration file: C:\Spl\SimSvn4.5\Source\Spl.Sim.Mvc\web.config 
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/spl.sim.mvc/5802065c/a2782d40/App_global.asax.olejmmua.dll. 
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. 

使用不同的生成配置是這樣的結果:

構建64位,32位應用程序池錯誤:錯誤

構建的x​​86,32位應用程序池錯誤:錯誤

構建AnyCPU,32位應用程序池錯誤:錯誤

構建64位,32位應用程序池真:錯誤

構建的x​​86,32位應用程序池真:OK

構建AnyCPU,32位應用程序池真:OK

IIS快遞:OK

我怎樣才能找到使用的32位DLL問題在64位配置?

回答

6

我發現了這個問題。我使用Instrumentation進行分析。這增加以下行到Web.config:

<dependentAssembly> 
    <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
    <codeBase version="11.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2011.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL" /> 
    </dependentAssembly> 

從web.config部分,該計劃正在按預期刪除此dependentAssembly後。我還從compilation元素中刪除了assemblyPostProcessorType屬性

+0

保存了我的一天。但與此問題是,我需要刪除我的開發計算機web.config上的依賴程序集,並應該重建應用程序。 –

相關問題