.NET Remoting - PowerPoint PPT Presentation

About This Presentation
Title:

.NET Remoting

Description:

Priyanka Bharatula.NET Remoting allows an application to make an object available across remoting boundaries, which includes different appdomains, processes or even ... – PowerPoint PPT presentation

Number of Views:139
Avg rating:3.0/5.0
Slides: 16
Provided by: Gai1151
Learn more at: https://www.cs.odu.edu
Category:
Tags: net | net | remoting

less

Transcript and Presenter's Notes

Title: .NET Remoting


1
.NET Remoting
  • Priyanka Bharatula

2
Introduction
  • .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
  • A remotable 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 host application 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
Types 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 Service one and only one request
    coming in
  • Singleton Call Service multiple clients and is
    useful when data needs to be shared explicilty
    between several clients.
  • Client Activation Richer than singleton in many
    aspects as they can store the state information
    between method calls for its specific client.

5
.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 objects
    origin

6
Remotable Types
  • Marshal-by-value
  • - all serializable types.
  • - can be used as parameters of remote calls
    where copy of the object is passed to the remote
    application.
  • Marshal-by-object
  • - Types derived from System.MarshalByRefObject
  • - A proxy is passed to the remote application
    where methods are executed remotely

7
Managing Life Time of an Object
  • Lease-based object lifetime
  • Each server-object 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.

8
Managing Life Time of an Object ...
  • sponsor is an object running on sever itself,
    client or any machine reachable via a network
  • An object subject to garbage collection if
  • A sponsor decides lease will not be renewed
  • Framework unable to contact any registered
    sponsors
  • If a client references time out object, an
    exception is thrown
  • System.Runtime.Remoting.Lifetime class

9
Channels
  • Channels are responsible for passing messages
    across remoting boundaries.
  • Channels must be registered before objects are
    created as per application domain.
  • Two pre-defined .NET Remoting channels existing
    are the TcpChannel and the HttpChannel.

10

Remoting Architecture
11
Activation
  • Server activated objects(SAO)
  • - constructed implicitly by the server when a
    method is invoked for the first time
  • - can be either singleton/single call
  • Client activated objects(CAO)
  • - constructed explicitly by the client using
    new or Activator.CreateInstance with an arbitrary
    constructor.
  • - stateful objects

12
Types of Invocation
  • Synchronous Calls
  • Client waits until server finishes processing the
    request
  • Asynchronous Calls
  • Delegates at work
  • One-Way Calls
  • Framework does not guarantee their execution
  • Method cannot have return values or out
    parameters
  • No exception thrown even if server is down or the
    method call is malformed
  • Used in uncritical logging or tracing facilities

13
.Net Remoting Vs Web Services
  • XML Web Services
  • simple, loosely coupled programming model.
  • can be accessed only over HTTP and work in a
    stateless environment.
  • services hosted in IIS.
  • .Net Remoting
  • Tightly coupled and more complex programming
    model.
  • can be accessed over any protocol and support
    both stateful and stateless environments.
  • services hosted in any AppDomain.

14
References
  • Advanced .Net Remoting Ingo Rammer Mario
  • http//www.thinktecture.com/
  • .Net Remoting Technical Overview
  • http//msdn.microsoft.com/en-us/library/kwdt6w2k(V
    S.71).aspx
  • .NET Remoting Versus Web Services
  • http//www.developer.com/net/net/article.php/11087
    _2201701_1

15
Thank you
Write a Comment
User Comments (0)
About PowerShow.com