1

I have a WCF service that depends on 32-bit DLLs, and as such it needs to run in 32-bits mode. However, on a 64-bits Windows 7 machine, Visual Studio 2010 starts WcfServiceHost.exe in 64-bits, and when it tries to load my service, it throws a BadImageFormatException.

How can I debug a 32-bits WCF service on a 64-bits machine?

zneak
  • 134,922
  • 42
  • 253
  • 328
  • Seems duplicate of http://stackoverflow.com/questions/727313/badimageformatexception-encountered-with-wcfsvchost-and-iis-wcf-host – Craig A Aug 08 '12 at 19:59
  • @CraigA, it has no satisfying answers for the Visual Studio case and mostly focuses on IIS hosting the service. But yeah, it's the same issue. – zneak Aug 08 '12 at 20:02

1 Answers1

2

Unfortunately, WcfServiceHost.exe will always run 64bit on a 64bit system. You can explicitly modify it to run in 32bit, but this is a fairly harsh workaround.

I typically will write my own hosting application, and use it to debug the service directly instead of using WcfServiceHost if you need to control the runtime mode.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373