FAQ TBarCode in Web Applications
Incorrect Format Error
Incorrect Format Error
After deploying your web application you get:
- Could not load file or assembly TECIT.TBarCode or one of its dependencies. An attempt was made to load a program with an incorrect format.
The possible reason for this problem is that you added the 32-bit variant of the TBarCode Assembly to your application (typically because Visual Studio development web server runs in 32 bit mode). But your web server is running on a 64 bit system and your application pool is adjusted to not support 32 bit. Now the application wants to load a 64-bit library but it finds the 32 bit version instead, this leads to the incorrect format error.
There are two options for a solution:
- You can switch to 32 bit by changing the Enable 32 Bit property in your IIS application pool (advanced settings). I suggest to do that only if your web application has a dedicated application pool configured only for this one app and there is no requirement to run the app as 64 bit.
- Or you remove all TBarCode relevant libraries from your app/bin folder, install the TBarCode x64 SDK MSI setup on your web server and then do either a reboot or run the iisreset command on an admin console prompt (all apps are restarted). Doing it that way IIS will resolve either the 64 bit or the 32 bit variant from the GAC (Global Assembly Cache) automatically. In the GAC our setup stores copies of the TBarCode Library/Assembly in both 32 and 64 bit formats.
If your web server hosts also other applications you should do a reset in a dedicated maintenance time frame or while nobody else accesses the server.