日期:2014-05-19  浏览次数:20942 次

怎样进行多程序间数据交互
最近在构思一个程序。由于该程序可能要集成在其他程序中,因而需要获得集成平台的一些数据、信息。我想问一下,除了通过文件方式传递数据还有其他的方法吗?能否给个小例子参考一下。谢谢。

------解决方案--------------------
.net3.0增加了进程通信的例子
------解决方案--------------------
一楼的差不多就都列全了,其中WCF是.NET 3.0 中新的,它是MS建议用的. 如果LZ用.NET 3.0, 就别考虑Remoting,直接用WCF最好.
------解决方案--------------------
using System;
using System.Collections.Generic;
using System.Text;

namespace RemoteObject
{
public class MyRemoteObject : MarshalByRefObject
{
public MyRemoteObject()
{
Console.WriteLine( "Constrcture called! ");
}

public string SayHello()
{
Console.WriteLine( "Hello, World! ");
return "Hello! .Net Client ";
}
}
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting;

namespace Server
{
class Program
{
static void Main(string[] args)
{
RemotingConfiguration.Configure( "Server.exe.config ", false);
Console.WriteLine( "Press return to exit ");
Console.ReadLine();
}
}
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting;
using RemoteObject;

namespace Client
{
class Program
{
static void Main(string[] args)
{
RemotingConfiguration.Configure( "Client.exe.config ", false);
MyRemoteObject obj = new MyRemoteObject();
Console.WriteLine(obj.SayHello());
Console.ReadLine();
}
}
}