我按照IpcChannel类的MSDN示例: http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcchannel.aspx
我制作了两个控制台应用程序项目:
客户:
namespace IPC_Client_Test
{
class Program
{
[SecurityPermission(SecurityAction.Demand)]
public static void Main(string[] args)
{
// Create the channel.
IpcChannel channel = new IpcChannel();
// Client code
服务器:
namespace IPC_Server_Test
{
class Program
{
[SecurityPermission(SecurityAction.Demand)]
public static void Main(string[] args)
{
// Create the server channel.
IpcChannel serverChannel =new IpcChannel("localhost:9090");
// Server Code
我运行服务器然后启动客户端,我在这一行获得了一个例外:
Console.WriteLine("The remote object has been called {0} times.", service.GetCount());
无法加载类型'IPC_Client_Test.RemoteObject,IPC Client Test,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'。
答案 0 :(得分:0)
当我开始使用IPC时,我在网上搜索并找到了来自TechRepublic的Zach Smith的一些例子。我想你可以从这开始。它帮助我建立了一个基本的IPC。