以x64运行ASP.NET项目. BadImageFormatException [英] Running ASP.NET project as x64. BadImageFormatException

查看:90
本文介绍了以x64运行ASP.NET项目. BadImageFormatException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2008中有一个解决方案文件,其中包含1个ASP.NET项目和2个其他项目. ASP.NET项目引用了其他2个项目.

最近将其他2个项目更改为x64. ASP.NET项目已更改为x64.有问题的计算机是Windows 7 64位计算机.

当我在Visual Studio中以调试方式运行ASP.NET项目时,出现编译错误.错误说:

< pre>''无法加载文件或程序集&#39; ClientPage,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null&#39;或其依赖项之一.试图加载格式不正确的程序.''

[BadImageFormatException:无法加载文件或程序集"ClientPage,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null"或其依赖项之一.试图加载格式不正确的程序.]</pre>

我能够将这个项目调试为任何CPU".为什么我不能将其作为x64运行.我的电脑是x64.

我在同一解决方案中的所有其他项目都设置为64位,并且我可以独立执行它们(作为启动项目)而没有任何问题.

I have a solution file in Visual Studio 2008 with 1 ASP.NET project and 2 other projects. The ASP.NET project references the other 2 projects.

The other 2 projects were recently changed to build as x64. The ASP.NET project was changed to x64. The computer in question is a Windows 7 64 bit machine.

When I run the ASP.NET project in Visual Studio as debug, I get compilation errors. The error say:

<pre>''Could not load file or assembly &#39;ClientPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&#39; or one of its dependencies. An attempt was made to load a program with an incorrect format.''

[BadImageFormatException: Could not load file or assembly ''ClientPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'' or one of its dependencies. An attempt was made to load a program with an incorrect format.]</pre>

I was able to debug this project as ''Any CPU''. Why am I not able to run it as x64. My PC is x64.

All my other projects in the same solution were set to 64 bit and I can execute them indedependently (as startup projects) without any problems.

推荐答案

ClientPage程序集是否已编译在64位?如果您的解决方案引用的是32位版本,则会出现此错误.
Is the ClientPage Assembly compiled in 64bit? If your solution is referencing a 32bit version, you will get this error.


将Page指令的validateRequest属性设置为false:
set the validateRequest attribute of the Page directive to false:
<%@ Page validateRequest="false" %> 


对于服务器上的所有应用程序


For all applications on your server

<configuration> <system.web> <pages validateRequest="false" /> </system.web> </configuration>



有关此的更多信息,您可以在此处导航

如果我误解了您的问题,请随时纠正我.希望以上信息对您有所帮助.如果您还有其他顾虑,请告诉我.
如果这确实对您有帮助,请不要忘记投票并接受答案.



For more information regarding this you can navigate here

If i misunderstand your question, please feel free to correct me.I hope the above information will be helpful. If you have more concerns, please let me know.
If this would be really helpful to you then don''t forgot to Vote and Make Answer as Accepted.


这篇关于以x64运行ASP.NET项目. BadImageFormatException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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