问题
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.
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.
Could not load file or assembly '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
I am using ASP.Net4.5 MVC
回答1:
As @DimitryDovgopoly noted, this is a bitness issue.
When you push changes to the remote server, the application pool recycles.
If your 64bit app is the first to load into that process, then the 64bit version of the assembly is loaded.
If a 32 bit app loads into the same app pool first, it will load the 32bit version of the assembly.
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.
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).
回答2:
Strange but this fixed my error..
I am using EF profile to anaylyze ef queries..and I had reference to Hibernate.Rhinoes.dll and I just thought of removing this refererece from my solution.
When I removed and rebuilded and deployed, it fixed my issue.
回答3:
I think this error is due to different framework version in hosting server. Please, check framework version.
来源:https://stackoverflow.com/questions/33460847/system-badimageformatexception-could-not-load-file-or-assembly-exception-only