如何在.NET中的64位进程32位进程进行通信? [英] How can a 32 bit process communicate with a 64 bit process in .NET?

查看:386
本文介绍了如何在.NET中的64位进程32位进程进行通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows没有使人们有可能为32位进程加载64位的DLL,所以我试图用远程,为了让32位程序与64位进程进行交互。

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.

下面的问题:当两个应用程序位于同一台机器上,一个是32位的,另一个是64位的,他们必须是这个样子:让32位或64位将打破一切这些应用程序建立在顶

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.

我使用.NET的System.Runtime.Remoting.RemotingConfiguration类,并调用它的配置()方法,并传递一个引用它引用,我会通过远程访问MarshalByRefObject类的App.config文件。

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.

我得到它的工作,但前提客户端,主机,MarshalByRefObject的类或者是32位或64位。如果我混合起来,这将不起作用:我结束了一个BadImageFormatException:

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:

无法加载文件或程序集MyRemotingObject或它的某一个依赖。试图用不正确的格式加载程序。

Could not load file or assembly 'MyRemotingObject' or one of its dependencies. An attempt was made to load a program with an incorrect format.

例外消失了,只要我让这两个应用程序是32位或64位,但同样的,其中一人必须为32位,另一个64位。

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.

有人可以告诉我如何使32位.net应用程序和0.64位.NET应用程序之间的进程间通信?

Can someone tell me how to enable interprocess communication between a 32 bit .NET app and a .64 bit .NET app?

推荐答案

随机猜测:.NET远程处理需要组装加载到这两个进程弄个元数据。你的数据契约(到使用WCF术语)应在一个单独的组件,并应被编译为值为anycpu,以便它可以被装入过程。你有它明确地设置为32位或64位。

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.

这篇关于如何在.NET中的64位进程32位进程进行通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆