IIS server exceptions

You may encounter BadImageFormatException, incorrect format exceptions when using PDFNet on IIS. One possible cause can be that you need to match the IIS Enable 32-bit application setting to which version of PDFNet (32 or 64 bit) that you are using.

In the case of IIS 2008 R2 Web Server application pool, set the Identity to "LocalSystem" (for both .NET 2.0 and .NET 4.0). Also, make sure to set the "Enable 32-Bit Applications" to "True".

Latest versions of Visual Studio now include 64bit IIS. You can set this by going to Tools -> Options -> Project and Solutions -> Web Projects and checking "Use the 64 bit version of IIS Express".

Finally, be aware that different versions of IIS default to different versions of the .NET Framework, so you may need to match that with the version of PDFNet you are using (.NET 2 or 4).

Using the demo version with IIS

If you are trying to run your demo on an IIS server, you can change the Application Pool’s identity to a User Account with read/write access to the registry.

  1. Go to IIS Manager, select the web server, and then Application Pools.
  2. Click on the Application Pool you are using from the list, then on the Actions panel, under Edit Application Pool, click Advanced Settings...
  3. In the Advanced Settings dialog, go to the Process Model section and click on the Identity to change it.
  4. Once the Application Pool Identity dialog shows up, select Custom account:, then click Set...
  5. Enter the user account information in the Set Credentials dialog box. Note: you may have to specify the domain of the user (i.e. MyServerDomain\MyUserAccount).
  6. Click OK until all dialog boxes are closed.

See Forum: How do I resolve 'BadImageFormatException' when using 64-bit version of PDFNet for .NET? for more information.

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales