2. IntroductionIntroduction
.NET Remoting allows an application to make an object
available across remoting boundaries, which includes different
appdomains, processes or even different computers connected by
a network.
The framework provides a number of services, including object
activation and object lifetime support, as well as communication
channels which are responsible for transporting messages to and
from remote applications.
3. .NET Remoting Components.NET Remoting Components
A remote object: Which is an object that contain some
properties and methods located in one application domain and you
need to call its methods or properties from another application
domain or process.
A remoting host: This is the host of the remotable object also
called as the server application. The main task of this host is to
listen to requests for the hosted remotable object.
A client application: This is the application which makes
requests for the remotable object.
4. .NET Components cont….NET Components cont…
A serializable object: Is an object that’s made available over
remoting by marking the class with <serializable()> attribute.
This object moves from machine to machine. E.g. Dataset
A channel: Is a way of communicating between two machine.
.NET comes with two channels. TCP & HTTP.
A formatter Object: Is used to serialize or marshal an object’s
data into a format in which it can be transferred down the channel.
5. A messanger: Is a communication between client and server.
A proxy: Is used on the client side to call into the remote
object. To use remoting , you don’t typically have to worry about
creating the proxy infact .NET can do it all for you.
A message sink: Is an “Interceptor object” before message go
into the channel. This is done to attach more data, reformate data
before it is sent, rout debugging information or perform security
checking. We have two sink :- “envoy sink” on client side and
“server context sink” on server side.
.NET Components cont….NET Components cont…
7. Types of Remotable ObjectsTypes of Remotable Objects
There are 3 types of remotable objects that you can configure and
choose from depending on the requirements of your application.
Single Call Object: Service one and only one request coming in
Singleton Call Object: Service multiple clients and is useful when
data needs to be shared explicitly between several clients.
Client Activation Object: Richer than singleton in many aspects as
they can store the state information between method calls for its specific
client.
8. SingleCall ObjectsSingleCall Objects
Singlecall object act much like typically web service objects.
Each time a client calls a method on a singlecall object, an object
is created specially to handle that method call. Once the method
call is complete the object is not reused and its garbage collected
by the .NET runtime .
These object must inherit from System.MarshalByRefObject
i.e. MBRO’s. They always run in the AppDomain and windows
process where they are created. Clients interact with them across
the network.
Singlecall is the most commonly service object used in
remoting. This object provide similar to web services, MTS, and
COM+.
9. Singleton ObjectsSingleton Objects
Singleton object are quite different from singleCall objects.
Only one singleton object exists at a time, and it may exists for a
long time and maintain states. All clients have equal shared access
to any states maintain by the singleton object.
These object must inherit from System.MarshalByRefObject
i.e. MBRO’s.
All methods calls are run on threads from the .NET thread pool.
This means that multiple simultaneous method calls can be
running on different threads at the same time.
Singleton objects have a potentially unpredictable lifespan.
When the first client makes the first method call to the object it is
created. From that point forward, it remains in memory for an
indeterminate period of time.
10. Activated ObjectActivated Object
Client-Activated Objects are different from both singleCall and
singleton Objects. This objects are created by a client application
and they remain in memory on the server over time. They are not
shared between clients. They can maintain data in memory during
their life time.
These object must inherit from System.MarshalByRefObject
i.e. MBRO’s
A client can create multiple activated objects on the server. The
objects will remain on the server until the client releases the
objects or the server Appdomain is reset. If the client doesn’t
contact the server for several minutes, the server will assume the
client abandoned the object and it will release them.
11. Activated Object conti…Activated Object conti…
Activated objects typically don’t have any threading issue. The
only way ,multiple thread will be running in the same activated
object is if the client is multithreaded and multiple client threads
simultaneously make method calls to the same server-side
activated object.
12. For queries mail me onFor queries mail me on
nikks9.palyekar@gmail.comnikks9.palyekar@gmail.com