VS2015项目在x64平台下崩溃

时间:2016-01-29 19:56:17

标签: asp.net-mvc-4 visual-studio-2015

我在VS2015中运行Asp.Net Razor应用程序。当我在x64调试模式下运行时,出现以下错误:

[BadImageFormatException: Could not load file or assembly 'MyWebApp.DAL' 
or one of its dependencies. An attempt was made 
to load a program with an incorrect format.]



Assembly Load Trace: The following information can be helpful to determine why the assembly 'MyApp.DAL' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = MyApp.DAL
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: MyApp.DAL | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/MyApp/MyApp.WebApp/
LOG: Initial PrivatePath = C:\MyApp\WebApp\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\...\web.config
LOG: Using host configuration file: C:\Users\...\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/76dd151c/b29594f/MyApp.DAL.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/76dd151c/b29594f/MyApp.DAL/MyApp.DAL.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.




如果我将构建属性(Debug - > Properties menut item)修改为" Active(Debug)"平台设置为"活动(x86)" - 一切都运行良好。

我有.Net Framework 4.6.1,产品版本4.6.01055。 根据RegEdit:

  [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\1033]
 "Version"="4.6.01055"
 "TargetVersion"="4.0.0"
 "Install"=dword:00000001
 "Servicing"=dword:00000000
 "Release"=dword:0006041f

非常感谢帮助,因此我可以在x64平台下运行。

鲍勃

1 个答案:

答案 0 :(得分:1)

查看项目属性<构建MyApp.DAL项目。该项目的Platform目标构建设置应为Any CPU