Windows does not make it possible for a 32 bit process to load a 64 bit dll, so I am trying to use remoting in order to allow the 32 bit process to interact with a 64 bit process.
Here's the problem: while the two applications are located on the same machine, one is 32 bit and the other is 64 bit, and they have to be that way: making both 32 bit or 64 bit would break everything these applications are built on top of.
I'm using .NET's System.Runtime.Remoting.RemotingConfiguration
class and calling its Configure()
method and passing a reference to an App.config
file which references the MarshalByRefObject
class that I'll be accessing via remoting.
I got it to work, but only as long Client, Host, MarshalByRefObject class are either 32 bit or 64 bit. If I mix them up this won't work: I'll end up with a BadImageFormatException
:
Could not load file or assembly '
MyRemotingObject
' or one of its dependencies. An attempt was made to load a program with an incorrect format.
The exception goes away as soon as I make both apps either 32 bit or 64 bit, but again, one of them must be 32 bit and the other 64 bit.
Can someone tell me how to enable interprocess communication between a 32 bit .NET app and a .64 bit .NET app?
Additionally, a 32-bit process cannot load a 64-bit DLL. However, 64-bit Windows supports remote procedure calls (RPC) between 64-bit and 32-bit processes (both on the same computer and across computers).
Most programs made for the 32-bit version of Windows will work on the 64-bit version of Windows except for most Antivirus programs. Device drivers that are made for the 32-bit version of Windows will not work correctly on a computer running a 64-bit version of Windows.
On 64-bit Windows, a 64-bit process cannot load a 32-bit dynamic-link library (DLL). Additionally, a 32-bit process cannot load a 64-bit DLL.
A 32-bit system has a limit of 32 bit Windows 3.2 GB of RAM. The limit in its addressable space doesn't allow you to use the entire physical memory space of 4GB. A 64-bit system enables its users to store up to 17 Billion GB of RAM.
Random guess: .NET remoting needs to load the assembly into both processes to get hold of the metadata. Your data contract (to use the WCF term) should be in a separate assembly and should be compiled as "AnyCPU", so that it can be loaded into either process. You've got it explicitly set to 32-bit or 64-bit.
You could used WCF through a named pipe.
There is a simple example here: http://msdn.microsoft.com/en-us/library/system.servicemodel.netnamedpipebinding.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With