Could Not Load File Or Assembly. An Attempt Was Made To Load A Program With An Incorrect Format

Опубликовано: 13 Октябрь 2024
на канале: Admin Technomark
34,834
73

Could Not Load File Or Assembly. An Attempt Was Made To Load A Program With An Incorrect Format

Please visit http://www.technomark.in/Could-Not-Lo... for more information.

You will get this error when you run a 32 bit application on 64 Bit IIS.
In your application, if any of the dll is of 32 bit, you can expect this error.
In 64 bit IIS, if you allow to run 32 bit application, you can resolve this issue.
Else make your application compatible to run on any Operating System.

For resolving this issue follow these steps.
1. Enable 32 bit application on IIS.
2. The Target Platform of your app should be compatible with where you deploy.
Lets consider each of them in detail.


1. Enable 32 Bit Application On IIS

First of all open your IIS. (On Run type inetmgr).
Select your Website. Click on Advanced Settings.
Note down your Application Pool under General Tab.
Now from list of Application Pool, Right Click on your Application Pool.
Select Advanced Settings.
Under General Tab Section, make Enable 32-bit Applications set to True.
Now press OK Button.
Refresh your Application to see whether the Issue is resolved or not.
Else follow second step.


2. Change Target Platform Of Your Application

Right click on your Project Icon and select Properties.
Under Build Tab, make sure on which Configuration you are going to Publish.
If final publish is on Release mode, select Release. Or select appropriate mode.
After selecting configuration, select Platform target from Any CPU to x86.
Now Save the changes and Rebuild the Solution.
Publish the Application to see the End Result.


In this video, we have explained about following thing

Could Not Load File Or Assembly. An Attempt Was Made To Load A Program With An Incorrect Format

Complete steps is described in this video regarding An Error Could Not Load File Or Assembly. An Attempt Was Made To Load A Program With An Incorrect Format

If you got any clarification on this, please write it on Comment section.

We will definitely update you back.