|
|||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionThis article and the accompanying source code demonstrate how to implement .Net Remoting using each of the combinations of formatters, channel protocols and activation modes. For this purpose, I have implemented a Facade for the .Net Remoting API. You might want to use the source code as a learning and experimentation tool to help understand how each remoting mode works through side by side comparison of the way each is implemented. BackgroundThere are many excellent articles on .Net Remoting on the net. The basic idea behind this pattern is to implement Client Activation by implementing Server Activation of a factory object and by then calling the factory method to create the remoted object on the server (and the proxy on the client). This strategy provides the functionality of Client Activation without the liability of having to copy remote object assembly onto each client location. As Juval explains in his article, Client Activation allows clients to instantiate a remote object for each activating client and to control the lifetime of that object. The implementation was inspired by this excellent article by Allen Anderson.Using the codeThe purpose of this sample solution is to add any two integers using a remote calculator object. The solution contains 4 assemblies:
Server.exe references CalculatorInterface.dll in order to derive the concrete Calculator object from this interface. It also references RemotingFacade.dll and uses its RemotingServer object to register the Calculator class for the server side of remoting. Client.exe references CalculatorInterface.dll in order to cast the reference to the remote calculator object to this interface. It also references RemotingFacade.dll and uses its RemotingClient object in the RemotingFacade.dll to obtain a proxy that references a remote Calculator. Points of InterestIt is important to note that of all 4 assemblies, only RemotingFacade.dll references System.Runtime.Remoting and uses its namespaces. Server.exe and Client.exe have no knowledge of .Net Remoting APIs. Conversely, RemotingFacade.dll has no knowledge of the Calculator object or even of its ICalculator interface. From the deployment point of view, Server.exe and Client.exe reside at different location, including on two different computers. Both locations will have copies of the CalculatorInterface.dll and RemotingFacade.dll assemblies. Having said this, the client location will not have a copy of Server.exe which implements the addition operation. HistoryVersion 1.0
|
||||||||||||||||||||||||||||||||||