System.BadImageFormatException:无法加载文件或程序集-仅在托管服务器上发生异常? [英] System.BadImageFormatException: Could not load file or assembly- Exception only on hosting server?

查看:114
本文介绍了System.BadImageFormatException:无法加载文件或程序集-仅在托管服务器上发生异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google上找到了此例外情况,并找到了几个很好的链接,并尝试了任何建议.但是仍然是同样的问题.

I have google this exception and found couple of good links as wel and tried whatever suggested. But still same issue.

此异常,即使在本地服务器上部署后也没有在任何本地服务器上出现.

This exception I am not getting on any of my local server even after deployment on my local server No such issues.

但是,当我将网站移至托管服务器时,它第一次加载时没有错误,但是一旦按下ctrl + f5键,我便开始收到此异常.

But when I move the site to hosting server, first time it loads with no error,but once I press ctrl+f5 I start getting this exception.

我仅在远程/托管服务器上遇到此异常.在我当地没有这样的例外.

http://prnt.sc/8x4bm7 This exception I am getting only on remote/hosting server. No such exception in my local.

可以无法加载文件或程序集'file:///C:\ WINDOWS \ Microsoft.NET \ Framework \ v4.0.30319 \ asp.net vs2010

按照上面的链接,我尝试了这个..但似乎无法解决问题.
我为此努力奋斗

as per the above link, I tried this..but doesn't seem to solve the issue.
I am banging my head for this

我正在使用ASP.Net4.5 MVC

I am using ASP.Net4.5 MVC

推荐答案

正如@DimitryDovgopoly指出的那样,这是一个小问题.

As @DimitryDovgopoly noted, this is a bitness issue.

将更改推送到远程服务器时,应用程序池将回收.

When you push changes to the remote server, the application pool recycles.

如果您的64位应用程序是第一个加载到该进程中的应用程序,则将加载程序集的64位版本.

If your 64bit app is the first to load into that process, then the 64bit version of the assembly is loaded.

如果先将32位应用程序加载到同一应用程序池中,它将加载程序集的32位版本.

If a 32 bit app loads into the same app pool first, it will load the 32bit version of the assembly.

这两种情况中的任何一种都可能导致另一个应用程序出现BadImageFormat异常.如果您认为自己可能已为应用程序修复了该问题,则可能是因为共享同一应用程序池的另一个应用程序已将其破坏.

Either one of these scenarios can cause a BadImageFormat exception for the other application. If you think you may have fixed it for your application, you may have broken it for another application that shares the same app pool.

请确保没有两个具有不同位数(32或64)的应用程序共享同一应用程序池.如果您使用的是64位应用程序,请考虑关闭对该池的32位支持(Enable32Bit = false).

Make sure that no two apps that have different bitness (32 or 64) are sharing the same app pool. If you have an application that is 64bit, consider turning off the 32bit support for that pool (Enable32Bit = false).

这篇关于System.BadImageFormatException:无法加载文件或程序集-仅在托管服务器上发生异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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