This is for my own reference, (and for the sake of anyone Googling) since this has been driving me crazy for months. Feel free to ignore if you’re not a geek. Feel free to correct it if you are.

When building a WCF project for the x86 architecture on an x64 machine/OS (like, say, Windows 7), you will get a BadFormatException when you try to debug it. This is because WcfSvcHost.exe will run in the mode defined by your architecture, regardless of your particular build environment. Microsoft says that this is working as intended. I say boloney, but I’m a VS version behind now. (I haven’t tested VS 2010 yet.)

Here is a link to part of the solution.


corflags /32BIT+ WcfSvcHost.exe

However, the signature of this assembly is now broken, and won’t load. So to bypass that:


sn -Vr WcfSvcHost.exe

to remove strong name signature verification.

DANGER:
Don’t do that unless you know what you’re doing! That opens up a huge security risk. Do not do that in a production environment! Only do it on your dev box!

Why not just build the app in x64 or (even better) Any CPU? Because I can’t get Oracle.DataAccess in 64-bit.