To read the first part of series. Click here.
Could not load file or assembly 'LinqToExcel' or one of its dependencies. An attempt was made to load a program with an incorrect format.
When you use the third party controls or api's into your application like installing from Nuget Package Manager you might face the error when you publish the application live.
Like I face the error after using the 'LinqToExcel' from Nuget Package Manager. Error is:
"Could not load file or assembly ‘LinqToExcel’ or one of its dependencies. An attempt was made to load a program with an incorrect format'.
This error raise when their is a version confliction occur. To resolve the issue you have to enable the application in 32 bit mode from IIS Manager. Follow these steps to fix the issue.
1. Open the IIS Manager
2. Go to the Server directory
3. Click on Application Pools
4. Right-click on “DefaultAppPool” if “DefaultAppPool” is set as ‘ApplicationPool’ for desire website else right-click on your custom pool name
5. Select “Advance Settings…”
6. In the “(General)” area, select the “Enable 32-Bit Applications” as “true”
7. Click “OK”
Here is the screenshot of the above workflow: