I followed the MSDN example for the IpcChannel class : http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcchannel.aspx
I made two Console Application Projects :
The client :
namespace IPC_Client_Test
{
class Program
{
[SecurityPermission(SecurityAction.Demand)]
public static void Main(string[] args)
{
// Create the channel.
IpcChannel channel = new IpcChannel();
// Client code
And th开发者_如何学Goe server :
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
I run the Server then launch the Client and I get an exeption at this line :
Console.WriteLine("The remote object has been called {0} times.", service.GetCount());
Cannot load type 'IPC_Client_Test.RemoteObject, IPC Client Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
When I started using IPC, I've search over the web and found some examples by Zach Smith, from TechRepublic. I think you could start by this. It helped me to make a basic IPC.
http://www.techrepublic.com/article/using-ipc-channels-and-net-framework-20-to-communicate-between-processes/6143016
精彩评论