How do I resolve 'BadImageFormatException' when using 64-bit version of PDFNet for .NET?

812 views
Skip to first unread message

Support

unread,
Jun 13, 2011, 3:36:30 PM6/13/11
to PDFTron PDFNet SDK
Q: How do I resolve 'BadImageFormatException' when using 64-bit
version of PDFNet for .NET in Visual Studio Web Server?

I get the following error:

[BadImageFormatException: Could not load file or assembly 'PDFNet' or
one of its dependencies. An attempt was made to load a program with an
incorrect format.]

I am using 64-bit version of 64-bit machine, so why do I get this
error?

---------------

A: The problem may be related to Visual Studio Web Server which is by
default 32-bit - even on 64-bit systems.

From '64-bit read me.txt':

"If you are running a 64-bit version of this sample project, it must
be run on 64-bit web server or an error will be generated. Visual
Studio's development web server is only available in 32-bit, so visual
studio must be configured to use a 64-bit version of IIS, or
alternatively, a 64-bit version of CassiniDev. CassiniDev is "a fully
compatible drop-in replacement for the Visual Studio 2008/2010
development server". CassiniDev is available from http://cassinidev.codeplex.com/

Alternatively, the 32-bit version of PDFNet can be used for
development."

Support

unread,
Mar 8, 2012, 2:01:33 PM3/8/12
to pdfne...@googlegroups.com
 
Btw. you could use 32 bit version of PDFNet on both systems. In this case in your 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".

Ryan

unread,
Jan 13, 2017, 5:27:33 PM1/13/17
to PDFTron PDFNet SDK
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"


Reply all
Reply to author
Forward
0 new messages