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




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.

Could Not Load File Or Assembly  An Attempt Was Made To Load A Program With An Incorrect Format, Could Not Load File Or Assembly, An Attempt Was Made To Load A Program With An Incorrect Format, Enable 32 Bit Application On IIS, The Target Platform of your app should be compatible with where you deploy, IIS, Asp.Net, MVC, Application Pool, Platform target





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.



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.

Could Not Load File Or Assembly  An Attempt Was Made To Load A Program With An Incorrect Format, Could Not Load File Or Assembly, An Attempt Was Made To Load A Program With An Incorrect Format, Enable 32 Bit Application On IIS, The Target Platform of your app should be compatible with where you deploy, IIS, Asp.Net, MVC, Application Pool, Platform target

Now press OK Button. Refresh your Application to see whether the Issue is resolved or not. Else follow second step.



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.

Could Not Load File Or Assembly  An Attempt Was Made To Load A Program With An Incorrect Format, Could Not Load File Or Assembly, An Attempt Was Made To Load A Program With An Incorrect Format, Enable 32 Bit Application On IIS, The Target Platform of your app should be compatible with where you deploy, IIS, Asp.Net, MVC, Application Pool, Platform target

Now Save the changes and Rebuild the Solution. Publish the Application to see the End Result.