Раздел «Технологии программирования».DotNetRemotingModule:

.NET Remoting


Summary

.NET remoting enables client applications to use objects in other processes on the same computer or on any other computer available on its network. You can also use .NET remoting to communicate with other application domains in the same process. .NET remoting provides an abstract approach to interprocess communication that separates the remotable object from a specific server and client process and from a specific mechanism of communication. As a result, it is flexible and easily customizable.

Application Domain

Application domains provide a unit of isolation for the common language runtime. They are created and run inside a process. Application domains are usually created by a runtime host, which is an application responsible for loading the runtime into a process and executing user code within an application domain. The runtime host creates a process and a default application domain, and runs managed code inside it. Runtime hosts include NET, Microsoft Internet Explorer, and the Windows shell.

See also:

.NET Remoting

CLR host

Изоляция

Marshalling

Marshal By Reference

MarshByRef.gif

Remote Components

Приготовления на стороне клиента

Активация объекта

Примеры создания и использования

Клиент
      TcpChannel chan = new TcpChannel(8085);
      ChannelServices.RegisterChannel(chan);
      RemotingConfiguration.RegisterWellKnownServiceType
      (Type.GetType("CSRemotingSamples.HelloServer,object"), 
      "SayHello", WellKnownObjectMode.SingleCall);

Сервер

TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
WellKnownClientTypeEntry remotetype = new 
        WellKnownClientTypeEntry(typeof(HelloServer),
          "tcp://localhost:8085/SayHello");
RemotingConfiguration.RegisterWellKnownClientType(remotetype);
HelloServer obj = new HelloServer();

Использование файла настроек

Необходимый код (server.cs)
  RemotingConfiguration.Configure( "server.exe.config" );

Файл настроек (server.exe.config)

<configuration>
<system.runtime.remoting>
<application name="server">
<service>
<wellknown mode="Singleton"
type="CSRemotingSamples.HelloServer, object"
objectUri="SayHello" />
</service>
<channels>
<channel ref="tcp" port="1234" />
</channels>
</application>
</system.runtime.remoting>
</configuration>

Сборки

See also:

Links

-- AndreyUstyuzhanin - 06 Apr 2004

Attachment sort Action Size Date Who Comment
example.zip manage 5.5 K 13 Apr 2004 - 15:59 AndreyUstyuzhanin