BadImageFormatException running 64-bit GemFire Native Client based ASP.Net Web Application under Visual Studio
search cancel

BadImageFormatException running 64-bit GemFire Native Client based ASP.Net Web Application under Visual Studio

book

Article ID: 294254

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

Symptoms:
BadImageFormatException running 64-bit GemFire Native Client based ASP.Net Web Application under Visual Studio.

Attempting to run a ASP.Net WebApp assembly linked against a 64-bit version of GemFire Native Client under Visual Studio results in error: 
[BadImageFormatException: Could not load file or assembly 'GemStone.GemFire.Cache, Version=3.6.0.1, Culture=neutral, PublicKeyToken=126e6338d9f55e0c'
Or, one of its dependencies. An attempt was made to load a program with an incorrect format.

Environment


Cause

This issue occurs because the Visual Studio Development web server (webDev.WebServer.exe) that Microsoft Visual Studio uses is exclusively 32-bit. There is no native 64-bit support, so it only loads 32-bit compatible .dll files.

Resolution

To resolve this issue, configure Visual Studio to Use Local IIS Web Server for debugging (the details of this vary by Visual Studio version). Since IIS on a 64-bit machine can run in either 32- or 64-bit mode, it should have no trouble loading the application with the 64-bit libraries.