Unformatted text preview:

.Net RemotingRemoting IntroductionRemoting BenefitsWhy use .Net Remoting ?.Net Remoting BenefitsSlide 6.Net Remoting BasicsSlide 8Slide 9Slide 10First Remoting ApplicationMarshalByRefObjectsMarshalByRefObjects (CAO)Slide 14Factory Design PatternFactory Design PatternManaging Life Time of an ObjectSlide 18Types of Invocation.Net Remoting vs Web ServicesReferences.Net Remoting.Net RemotingCS-795 Security In Distributed Systems Using .NetSummer 2007Old Dominion UniversityRemoting IntroductionRemoting IntroductionThe process of programs or components interacting across certain boundaries either different processes or machinesDeveloper Speak - Remoting allows you to pass objects or values across servers in different domains using several different protocols.01/15/19 2Remoting BenefitsRemoting BenefitsCentralized Business LogicPhysical Separation of LayersSecure Third Party Access01/15/19 3Why use .Net Remoting ?Why use .Net Remoting ?Objects in different .NET application domains cannot access each other directly◦two apps running on same machine even cannot talk to each other without a third party (text files, logs etc)Enables client code in one application domain to call methods/properties of objects running in another application domain..Net analogy to DCOM01/15/19 4.Net Remoting Benefits.Net Remoting BenefitsMultiple transfer mechanisms – HTTP/TCP◦If there is no web server running – put traffic on port 80Multiple encodings – SOAP/ Binary (your own-serialization).NET Remoting is more flexible (more activation and deployment options).NET Remoting is customizable (you can add logging or other features)01/15/19 5.Net Remoting Benefits.Net Remoting Benefits.Net Remoting enables you to work with stateful objectsInterface description does not have to be manually coded in any way, as metadata can be extracted from running servers, or from any .Net assemblyOne of the major benefits is that it’s centralized around well-known and well-defined standards like HTTP and is directly tied to the .Net Framework01/15/19 6.Net Remoting Basics.Net Remoting BasicsClientProxiesFormatterTransportChannelServerDispatcherFormatterTransportChannelServer-SideObjectFig. The .Net Remoting Architecture01/15/19 7.Net Remoting Basics.Net Remoting BasicsDifferent Ways of defining interfaces:◦Shared Assembly◦Shared Interface or Base Objects◦Generated Metadata Assembly (SoapSuds)Serialization of Data:◦Encoding/Decoding of Objects natively supported◦Just need to mark such objects with [Serializable] attribute or implement the interface ISerializableLifetime Management◦Open network connection between client-server◦Combined reference counting and pinging mechanisms◦Objects get lifetime when created (reset: time-to-live)Sponsor registered with a server-side objectMultiserver/Multiclient◦.Net automatically keeps track of remote object’s origin01/15/19 8.Net Remoting Basics.Net Remoting Basics2 very different kinds of Objects◦Passed by ReferenceThese objects live on serverOnly ObjRef will be passed aroundThe client usually may not have compiled objects in one of its assemblies, instead only a interface or Base class is available to clientProxy Object takes care of all remoting tasks01/15/19 9.Net Remoting Basics.Net Remoting Basics2 very different kinds of Objects◦Passed by ValueThese objects will be passed over remoting boundariesSerialized into a string or binary representation and restored as a copy on other side of comm. channelEach one has its own copy and run independentlyClient has to have the compiled object in one of its assembliesMust support Serialization[Serializable] class-level attribute or ISerializable interface01/15/19 10First Remoting Application First Remoting Application ICustomerManager: Remote InterfaceCustomer: Data ObjectServer: Implements ICustomerManager interfaceClient: Consuming entityLet us see some code …01/15/19 11MarshalByRefObjectsMarshalByRefObjectsCategorized into 2 groups:◦Server-activated objects (SAOs)◦Client-activated objects (CAOs)SAO:◦Comparable to classic stateless Web Services◦No message travels to server on reference request by a client◦Only when methods are called on this remote reference will the server be notified◦Can be either Singleton / SingleCall◦How SAO (Singleton/SingleCall) works ? … code helps 01/15/19 12MarshalByRefObjects (CAO)MarshalByRefObjects (CAO)CAO:◦An instance of specified class created whenA creation request on the client is encountered using new operator or Activator.CreateInstance() methodAn activation message sent to the server◦Are stateful objects◦Will store state information from one method call to the other01/15/19 13MarshalByRefObjects (CAO)MarshalByRefObjects (CAO)◦Cannot use shared interface or assemblies◦Have to ship the complied objects to the clients or use SoapSuds to extract metadata out of a running server or a server-side implementation assembly◦SoapSuds suggested not be used anymore for .Net to .Net distributed applications◦Instead we use a factory design patternIn this a SAO provides methods to return new instances of the CAOHow CAO (factory design pattern) works ? … code helps01/15/19 14Factory Design PatternFactory Design Patternusing System;Namespace FactoryDesignPattern{class MyClass {}class MyFactory{public MyClass GetNewInstance(){return new MyClass();}}01/15/19 15Factory Design Pattern Factory Design Pattern class MyClient{static void Main(string[] args){ //creating using “new”MyClass obj1 = new MyClass();//creating using a factoryMyFactory fac = new MyFactory();MyClass obj2 = fac.GetNewInstance();}}}01/15/19 16Managing Life Time of an ObjectManaging Life Time of an ObjectLease-based object lifetime◦Each server-object is associated with a lease on creation◦Lease has time-to-live counter, decremented in certain intervals◦In addition, a defined amount of time is added on every method call a client places on remote object◦Upon reaching zero time, framework looks for a sponsor registered with the lease.01/15/19 17Managing Life Time of an ObjectManaging Life Time of an ObjectLease-based object lifetime◦A sponsor is an object running on sever itself, client or any machine reachable via a network◦An object subject to garbage


View Full Document

ODU CS 775 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?