.NET REMOTING CertSIG Tom Perkins. FUNDAMENTALS Distributed Applications Process A Process B Process C Objects can communicate across process boundaries.

Slides:



Advertisements
Similar presentations
Database Architectures and the Web
Advertisements

.NET Remoting in Delphi and C# Alain “Lino” Tadros President & CEO Falafel Software Inc. ComponentScience Inc. BORCON 2004.
.Net Remoting Pooja Panjala 06/17/10. Agenda What is.net Remoting? Explanation of terms Architecture Implementation of Remoting Sample example.net Security.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
C# and Windows Programming Application Domains and Remoting.
Author: Bill Buchanan. Authentication (to identify the clients of your application) Authorization (to provide access controls for those clients) Secure.
.NET Remoting. .Net Remoting Replaces DCOM (Distributed Component Object Model – a proprietary Microsoft technology for communication among software components.
Distributed components
Windows Communication Foundation and Web Services.
1 Advanced Programming Topics - II Objectives:  Background  Remoting  Types of remoting  Marshalling  Farmatters  Channels.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Distributed Systems Tutorial 2 -.NET Remoting. 2 What is Remoting?  Remoting allows you to pass objects or values across servers in different domains.
.NET Deployment Matt Smouse CSE775 – Distributed Objects Spring 2003.
CSE 636 Data Integration Web Services.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Communication in Distributed Systems –Part 2
ASP.NET Programming with C# and SQL Server First Edition
Getting Started with WCF Windows Communication Foundation 4.0 Development Chapter 1.
Lecture slides prepared for “Business Data Communications”, 7/e, by William Stallings and Tom Case, Chapter 8 “TCP/IP”.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
.NET, and Service Gateways Group members: Andre Tran, Priyanka Gangishetty, Irena Mao, Wileen Chiu.
The Design Discipline.
CIS NET Applications1 Chapter 10 – Remoting.
Meir Botner David Ben-David. Project Goal Build a messenger that allows a customer to communicate with a service provider for a fee.
.NET Remoting Architecture. Slide 2 CITE 4420.NET Remoting Topics Remoting Boundaries Crossing the Boundaries Distributed Applications Marshalling Channels.
.Net Remoting. 2 Distributed Computing under.Net In.Net, there are three levels of access to distributed computing machinery: In.Net, there are three.
ASP.NET  ASP.NET is a web development platform, which provides a programming model, a comprehensive software infrastructure and various services required.
Database Architectures and the Web Session 5
Protocol Architectures. Simple Protocol Architecture Not an actual architecture, but a model for how they work Similar to “pseudocode,” used for teaching.
Advanced Web Forms with Databases Programming Right from the Start with Visual Basic.NET 1/e 13.
Web Services & WCF ~ Ankit. Web services A web service is a collection of protocols and standards used for exchanging data between applications or systems.
Distributed Communication via ASP.Net Web Services and.Net Remoting By Richard King.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Develop Distributed Applications using.NET Remoting Kate Gregory Regional Director Gregory Consulting Limited
Unit – I CLIENT / SERVER ARCHITECTURE. Unit Structure  Evolution of Client/Server Architecture  Client/Server Model  Characteristics of Client/Server.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Grid Computing Research Lab SUNY Binghamton 1 Plans for Babelizing XCAT-C++ Madhu Govindaraju Kenneth Chiu.
Oracle 10g Database Administrator: Implementation and Administration Chapter 2 Tools and Architecture.
XML Web Services Architecture Siddharth Ruchandani CS 6362 – SW Architecture & Design Summer /11/05.
1 Welcome to CSC 301 Web Programming Charles Frank.
.Net Remoting The Other RPC Architecture Doug Gregory October 27, 2003.
.NET Remoting Chandra sekhar Chandra sekhar. What is.NET Remoting? What is.NET Remoting?.NET Remoting versus Distributed COM..NET Remoting versus Distributed.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Eric Tryon Brian Clark Christopher McKeowen. System Architecture The architecture can be broken down to three different basic layers Stub/skeleton layer.
Web Services from 10,000 feet Part I Tom Perkins NTPCUG CertSIG XML Web Services.
Endpoints Lesson 17. Skills Matrix Endpoints Endpoints provide a reliable, securable, scalable messaging system that enables SQL Server to communicate.
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
1 Nordjyllands Erhvervakademi Net Remoting Architecture Marshalling –Marshalling By Reference(MBR) –Marshalling By Value(MBV) Activation by MBR.
In this session, you will learn to: Understand managed code Create managed database objects Define the Hypertext Transfer Protocol endpoints Implement.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
.NET Remoting. Remoting Introduction The process of programs or components interacting across certain boundaries either different processes or machines.
Windows Communication Foundation and Web Services
Jim Fawcett CSE775 – Distributed Objects Spring 2003
.NET Remoting Priyanka Bharatula.
WEB SERVICES.
MCA – 405 Elective –I (A) Java Programming & Technology
Presentation 23 .NET Remoting Introduced
Matt Smouse CSE775 – Distributed Objects Spring 2003
Distribution of functionality Webservice using WCF
Windows Communication Foundation and Web Services
#01 Client/Server Computing
Client-Server Interaction
WEB API.
Distributed System using Web Services
Matt Smouse CSE775 – Distributed Objects Spring 2003
Jim Fawcett CSE791 – Distributed Objects Spring 2002
Matt Smouse CSE775 – Distributed Objects Spring 2003
Exceptions and networking
#01 Client/Server Computing
Presentation transcript:

.NET REMOTING CertSIG Tom Perkins

FUNDAMENTALS

Distributed Applications Process A Process B Process C Objects can communicate across process boundaries Objects may be on same computer, different computers, or Internet Heterogeneous architectures allowed Some processes can run even though others busy or have failed Application divided into tiers (layers) – gives increased flexibility and scalability

Process Boundaries Process A Process B Good News … Windows creates “process boundary” to isolate processes Keeps one process from affecting others Each process has its own virtual address space Executable code Data One process cannot access code or data of another process If process crashes it doesn’t affect others Bad News … Takes a lot of resources to create, monitor, and terminate processes Switching processes is expensive Many apps have many short-lived processes

Application Domains Process A Application Domain A Application Domain B CLR Provides managed execution Services: Cross-language integration Code access security Object lifetime management Debugging Profiling support Application can run in CLR in application domain Smallest execution unit in.NET Class  System.AppDomain Several app domains can run in a Windows process App domain boundary similar to process boundary, but much cheaper Can run multiple apps in same Windows process

3 Ways to develop Distributed Applications System.Net Namespace Standalone listeners Custom protocol handlers Requires good understanding of network programming System.Runtime.Remotin g Namespace Classes in this chapter Allows communication between objects in different app domains May be on separate computers Simple way for processes to communicate Key characteristics: flexibility and extensibility System.Web.Services System.web services namespace Classes make up ASP.NET Web Services Objects exchange messages in HTML and SOAP Key characteristics: simplicity and interoperability with other systems

What is.NET Remoting?.Net Remoting allows objects in different application domains to talk to one another It handles the details of network communication transparently

What about this business of no direct calls across application domain boundaries? Remoting uses indirect approach Creates proxy objects

.Net Remoting Architecture Client object Client App Domain Server App Domain Proxy Remoting System Server Object Channel

Marshalling Process of packaging and sending method calls among objects Uses serialization and deserialization

Remotable Objects Definition – objects that can be marshalled across application domains All other objects – non-remotable objects Two types of Remotable Objects –Marshal-by-value (MBV) Copied from server domain to client app domain –Marshal-by-reference (MBR) Uses proxy to access objects on client side Clients hold just a reference to these objects

Marshal-by-Value Objects Client App Domain Server App Domain Object resides here Client invokes a method on MBV object Object is serialized, transferred over network,restored on client as exact copy MBV object available on client; No proxy, no marshalling 4, Faster performance Fewer network roundtrips Large objects slow to move Doesn’t run in (better) server environment Create by declaring class serializable [Serializable] Public class MyMBVObject

Marshal-by-Reference Objects Client App Domain Server App Domain Object always resides, executes here Client invokes a method on object Local proxy holds reference to object 3, Increases number of network roundtrips Use when objects are large Or functionality available only on server public class MyMBRObject : MarshalByRefObject

Channels Objects that transport messages across application boundaries (computers, etc) When client calls method on server, info transferred through channel Info back through same channel Channels must be registered before they can be used

More about Channels Channel has 2 endpoints Receiving end (server) listens to particular protocol through specified port number Sending end (client) sends info using protocol and port number specified by server Receiving end  must implement IChannelReceiver Interface Sending end  must implement IChannelSender Interface Protocols –HTTP –TCP

Formatters Defn- objects used to serialize and deserialize data into messages before they are transmitted over a channel 2 Formatters –SOAP – SOAPFormatter class –Binary – BinaryFormatter class Defaults –HTTP Channel  SOAP formatter –TCP Channel  Binary formatter

Remote Object Activation Only MBR objects can be activated remotely 2 Categories of Activate objects –Server-activated objects –Client-activated objects Client object Server object

Server-activated Objects (SOAs) Object Lifetime controlled directly by server Remote object instantiated only when client calls a method on proxy object Client object Proxy object Server Object This guy controls its own lifetime

2 Activation Modes for SOAs Single-Call activation –Object instantiated only for purpose of fulfilling one client request –.NET then deletes and reclaims memory Singleton Activation mode –At most one remote object, regardless of how may clients may be using it –State can be maintained –Lifetime Lease determines its lifetime

When to use Single-Call activation –When it doesn’t cost much to create an object –No object state required –Server needs to support large number of requests for object –Load balancing environment –(retrieve inventory level for an item, display shipment info, etc) Singleton Activation –Use when it costs a lot to create an object –State required over a long period of time –Several clients need to work on the shared state –(Chat server – multiple people talk to same remote object and share data with one another)

Client-Activated Objects (CAOs) Lifetime is controlled by the client CAOs are instantiated on server as soon as the client requests the object to be created. Object creation is not delayed until first method is called by client. Client object Proxy object Server Object This guy controls this guy’s lifetime.

CAO Activation Client object Client App Domain Server App Domain Proxy Remoting System Server Object Channel 1. Client attempts to create an instance of the server object. 2. Activation request sent to remote server 3. Server creates object 4. Server return ObjRef object to client – info to build proxy object 5. Client uses ObjRef object to build proxy

CAO Characteristics Serves only client responsible for its creation Doesn’t get discarded with each request Can maintain state with client it is serving Unlike Singleton CAO’s, different CAOs cannot share a common state.

When to Use CAOs Clients want to maintain a private session with the remote object Clients want to have control over how the object is created and how long it should live. Example: a complex purchase order involving many roundtrips and clients want to maintain their own private state with the remote object

Comparing Object Activation Techniques Activation TypeFlexibilityScalability Single-Call Server Activation Singleton Server activation Client Activation Maximum scalability; remote object uses resources for min time; server can handle many clients Maximum flexibility; you have complete control over remote object construction and lifetime

Lifetime Leases Definition – the period of time a particular object will be in memory before deletion and garbage collection Used by Singleton SAOs and CAOs Object must implement Ilease interface in the System.Runtime.Remoting.Lifetime namespace

DEMO – 1.Create a Remotable class Must inherit from MarshalByRefObject class. This demo creates DbConnect class (will produce a remote server object) Purpose: connects to a SQL Server database Allows you to execute a SELECT statement to return a dataset – ExecuteQuery() method on the server object. Walkthru, then class is in DLL (bin\Debug) Still need to connect to Remoting Framework Client object Server object ExecuteQuery() SQL SELECT query dataset Remotable class

Server Program Connects to.Net Remoting Framework Listens to the client request Instantiates the remote object Invokes calls on remote object as requested by client Server Program Remote object Listens to client requests

Creating a Server-Activated Object (SAO) Remoting Server Program Channel Remoting Framework DbConnect Remotable class 1. create server channel – listens on particular port for activation requests from other application domains TcpServerChannel channel = new TcpServerChannel(1234) // port Register the channel with.Net Remoting 3 Register the remotable class RemotingConfiguration.RegisterWellKn ownServiceType( typeof(dbConnect), // type of class “DbConnect”, // URI of remotable class WellKnownObject Mode.SingleCall) // activation mode – c.b. Singleton Activation requests Remote object can be accessed through all registered channels

DEMO – 2. Create a Server- Activated Object (SingleCall) Exposes the remotable class through the remoting framework Long running process –No interface –Listens for incoming client requests on a channel This example uses a Console application (Should be a Windows service or IIS) Walkthru – StepByStep3_2 Creates a remoting host that listens on port 1234

DEMO – 3. Instantiate and Invoke a Server-Activated Object We’re building a Remoting Client We want to send messages to Remoting Server to activate the Remote object. Steps –Create and register a client channel to send messages to server; type s.b. compatible (TCP or HTTP) –Register the remotable class in the client’s app domain. –Instantiate the server object DbConnect dbc = new DbConnect();

StepByStep3_3 Windows application Accepts SQL SELECT string from user Passes it to remotable object Returned rows are displayed in datagrid