开发者

Could not load assembly error when changing to x64 platform

开发者 https://www.devze.com 2023-03-14 19:21 出处:网络
I have just created a new asp.net 3.5 web application. I went to the application property and changed 开发者_JS百科the platform target to x64. I didn\'t write any code and i have not changed anything.

I have just created a new asp.net 3.5 web application. I went to the application property and changed 开发者_JS百科the platform target to x64. I didn't write any code and i have not changed anything. Next i hit start debugging in Visual Studio. The following error occured:

Could not load file or assembly "SOLUTION NAME", 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.

Any one have an idea how to solve this?

Thanks.

Edit:

I have these warnings:

Warning 1 Assembly generation -- Referenced assembly 'System.EnterpriseServices.dll' targets a different processor

Warning 2 Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor

Warning 3 Assembly generation -- Referenced assembly 'System.Web.dll' targets a different processor

Warning 4 Assembly generation -- Referenced assembly 'System.Data.dll' targets a different processor

Configuration manager:

Could not load assembly error when changing to x64 platform


If you start your app just using F5 or Start button, and you debug on IIS, could be this:

Debug -> Options -> Projects and Solutions -> Web Projects. And select "Use the 64 bit version of IIS Express for web sites and projects".


I have found the problem.

It seems that Visual Studio and Cassini run as 32-bit applications. If i try to host my 64-bit ASP.NET application using Microsoft's Cassini, i will get an exception.

So i deployed my solution on IIS, changed it to 64-bit, debugged it and every thing is working perfectly.


Its likely to be a 32bit dll that is referenced.

If you are debugging on IIS, open the advanced settings of the application pool and make sure 'Enable 32 Bit Applications' is enabled. That has sorted the issue for a number of times.


In addition on what @winSharp93 says, have a look at the Application Pool Advanced Settings and ensure "Enable 32 Bit applications" is set to false.


Ensure that all dlls you compile are for 'any cpu' or are compiled for 'x64'. You can find this on the project settings window for each project.


Please check your references in the solution.Probably that is pointing to the old dlls.

0

精彩评论

暂无评论...
验证码 换一张
取 消