64 位 ASP.NET MVC 应用程序将无法运行 [英] 64-bit ASP.NET MVC App won't run

查看:33
本文介绍了64 位 ASP.NET MVC 应用程序将无法运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我以前设法让我的一个 64 位测试网络应用程序在这台机器上运行(回到我为这个项目设计原型时).我已经在 32 位上工作了几个星期,并意识到我需要将应用程序切换到 64 位,当我这样做(在项目中将目标平台设置为 x64)并重新部署时,它停止运行.

First of all, I've previously managed to get one of my 64-bit test web apps to run on this machine (back when I was prototyping for this project). I've been working for a few weeks in 32 bit and realized I need to switch the app over to 64-bit and when I did (Set target platform to x64 in the project) and redeployed, it stopped running.

上次让 64 位工作让我花了几天时间,我不确定这次我错过了上次做的什么.

It took me several days to get 64-bit working last time and I'm not sure what I'm missing this time that I did last time.

我正在 IIS 下发布和调试.

I am publishing to and debugging under IIS.

我收到 BadImageFormatException 消息:无法加载文件或程序集‘GEMS.Web’或其依赖项之一.尝试加载格式不正确的程序."

I get a BadImageFormatException with the message: "Could not load file or assembly 'GEMS.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format."

此应用程序同时引用 64 位和 32 位程序集.我已在 IIS 的应用程序池中将启用 32 位应用程序"设置为 true.

This app references both 64-bit and 32-bit assemblies. I have set "Enable 32-bit Applications" to true in the application pool in IIS.

我使用的是 VS.NET 2012、IIS 7.5,在 64 位 Win 7 机器上运行.

I'm using VS.NET 2012, IIS 7.5, running on a 64-bit Win 7 machine.

以下来自程序集加载跟踪:

The following is from the assembly load trace:

Assembly manager loaded from:  C:WindowsMicrosoft.NETFrameworkv4.0.30319clr.dll
Running under executable  C:WindowsSysWOW64inetsrvw3wp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = XXXXXXxxxxxx
LOG: DisplayName = GEMS.Web
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: GEMS.Web | 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:/inetpub/wwwroot/GEMS.Web/
LOG: Initial PrivatePath = c:inetpubwwwrootGEMS.Webin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:inetpubwwwrootGEMS.Webweb.config
LOG: Using host configuration file: C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.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/gems.web/eea5792e/72317e39/GEMS.Web.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/gems.web/eea5792e/72317e39/GEMS.Web/GEMS.Web.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/GEMS.Web/bin/GEMS.Web.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

推荐答案

如果您没有使用任何本机 Win32 库,您应该为您的程序集定位 Any CPU 而不要弄乱 在 IIS 中启用 32 位应用程序设置(将其保留为 false).

If you are not using any native Win32 libraries, you should target Any CPU for your assemblies and not mess with the Enable 32-bit Applications setting in IIS (leave it to false).

这篇关于64 位 ASP.NET MVC 应用程序将无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆