Presentation 23.NET Remoting Introduced. Ingeniørhøjskolen i Århus Slide 2 af 20 Outline.NET Framework introduced.NET Remoting strategies Architecture.

Slides:



Advertisements
Similar presentations
Presentation 10 SOAP on the Microsoft Platform (.NET)
Advertisements

Presentation 15 SOAP on the Microsoft Platform (.NET)
May 2, 2006Shawn Mulkey - EECS Distributed Computing & Object Oriented Middleware: Part 2 Presented By Shawn Mulkey.
.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.
C# and Windows Programming Application Domains and Remoting.
.NET REMOTING CertSIG Tom Perkins. FUNDAMENTALS Distributed Applications Process A Process B Process C Objects can communicate across process boundaries.
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.
Presentation 7 part 2: SOAP & WSDL. Ingeniørhøjskolen i Århus Slide 2 Outline Building blocks in Web Services SOA SOAP WSDL (UDDI)
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 FILE SYSTEM USING RMI
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Introduction to Remote Method Invocation (RMI)
.NET Deployment Matt Smouse CSE775 – Distributed Objects Spring 2003.
Microsoft.Net vs. J2EE Suresh Ramachandran Duke Energy.
.NET, and Service Gateways Group members: Andre Tran, Priyanka Gangishetty, Irena Mao, Wileen Chiu.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
Integrating CFML with ASP.NET Vince Bonfanti President New Atlanta Communications, LLC.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Introduction to .NET Rui Ye.
.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.
Presentation 15 SOAP on the Microsoft Platform (.NET)
CIS 375—Web App Dev II Microsoft’s.NET. 2 Introduction to.NET Steve Ballmer (January 2000): Steve Ballmer "Delivering an Internet-based platform of Next.
Presentation 8: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
Microsoft Visual Studio 2010 Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#:
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
Presentation 23: Comparison of technologies. Ingeniørhøjskolen i Århus Slide 2 af 15 Goals of this lesson After this 1x35 lessons you will have –Discussed.
Distributed Communication via ASP.Net Web Services and.Net Remoting By Richard King.
Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,
Microsoft Visual Studio 2010 Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#:
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.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
By: PHANIDEEP NARRA. OVERVIEW Definition Motivation.NET and J2EE Architectures Interoperability Problems Interoperability Technologies Conclusion and.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Presentation 22 Distributed Objects on the Windows platform.
Module 1: Overview of the Microsoft .NET Framework
Presentation 23:.NET Remoting Introduced Objektorienteret Middleware.
Presentation 11: RMI introduction. Ingeniørhøjskolen i Århus Slide 2 af 20 Goals of this lesson After these 2x35 lessons you will be –Introduced to Java.
Microsoft.Net vs. J2EE. J2EE – Enterprise Java  J2EE: Java 2 Enterprise Edition  Superset of Java 2 Standard Edition (J2SE)  Adds enterprise features.
.NET Mobile Application Development XML Web Services.
Java vs C# Johan Lindfors Microsoft AB. What are we to cover?  Java vs C#  Similarities and differencies  Specific issues  Deployment of applications.
1 Nordjyllands Erhvervakademi Net Remoting Architecture Marshalling –Marshalling By Reference(MBR) –Marshalling By Value(MBV) Activation by MBR.
Presentation 24 Ultra Simple.NET Remoting to CORBA bridge.
Topic 5: CORBA RMI Dr. Ayman Srour
Introduction to Web Services Srinath Vasireddy Support Professional Developer Support Microsoft Corporation.
.NET Remoting. Remoting Introduction The process of programs or components interacting across certain boundaries either different processes or machines.
Java Distributed Computing
Windows Communication Foundation and Web Services
Suresh Ramachandran Duke Energy
Jim Fawcett CSE775 – Distributed Objects Spring 2003
.NET Remoting Priyanka Bharatula.
Outline SOAP and Web Services in relation to Distributed Objects
Java Distributed Computing
Broker in practice: Middleware
Presentation 23 .NET Remoting Introduced
Matt Smouse CSE775 – Distributed Objects Spring 2003
Outline SOAP and Web Services in relation to Distributed Objects
Windows Communication Foundation and Web Services
Knowledge Byte In this section, you will learn about:
Matt Smouse CSE775 – Distributed Objects Spring 2003
Jim Fawcett CSE791 – Distributed Objects Spring 2002
Matt Smouse CSE775 – Distributed Objects Spring 2003
Presentation transcript:

Presentation 23.NET Remoting Introduced

Ingeniørhøjskolen i Århus Slide 2 af 20 Outline.NET Framework introduced.NET Remoting strategies Architecture Remoting object types Activation Lifetime Deployment Example application High-level introduction only!

Ingeniørhøjskolen i Århus Slide 3 af 20 Not a Windows.NET course You will NOT be required to be an expert on.NET You will be required to be knowledgeable about it History: –Open source, Java, Linux the WWW threatened MS –Especially Java was gaining widespread support amongst developers for its ease of use, productivity and heterogeneity –The Empire Strikes back = the.NET Framework

Ingeniørhøjskolen i Århus Slide 4 af 20 Benefits of.NET Changes EVERYTHING –Takes all that was nice in Java and enhances it –End of DLL incompatibilities, DLL Hell, COM registry hell –Enter world of VM’s and Java like code (C#) including Garbage collection – BUT with easy support for legacy umanaged code (e.g. C++ for speed) and COM –Performs much better than Java, and almost equivalent with Win32 C++ applications –Still only support Microsoft operating systems BUT –.NET and C# is ECMA standard: Mono ( for Linux is being developedwww.go-mono.org –IIOP.NET ( for CORBA interophttp://iiop-net.sourceforge.net/index.html

Ingeniørhøjskolen i Århus Slide 5 af 20 The.NET Framework Components Win32 MessageQueuingCOM+ (Transactions, Partitions, Object Pooling) IISWMI Common Language Runtime.NET Framework Class Library ADO.NET and XML XML Web Services User Interface Visual Basic C++C#PerlJScript… Application services. E.g. IIS, Message Queuing etc. CLR:runtime execution environment. Equlas JVM of Java. Microsoft Intermediate Language (MSIL) equals Java ByteCode A collection of class libraries (over 9000) wraps Win32 like Java API ActiveX Data Objects 3 types of user interfaces: Web forms, Windows forms (Win32), Command Console For inter-process communications Any language conforming to the Common Language Specification (CLS) may be used. Source code Source code Compiler Intermediate Language Intermediate Language.NET Framework.NET Framework Other IL libraries Other IL libraries Linker Linked Program Linked Program JIT-compiler Executable Program Executable Program Here we find the.NET Remoting libraries

Ingeniørhøjskolen i Århus Slide 6 af 20 Ressources for learning more.NET Feel free to learn more about.NET: –Getting started with the.NET framework –more specifically –Link can be found at the course site –Books on the subject of.NET Remoting Remoting with C# and.NET by David Conger, Wiley (2003) MSDN: Networking and Communication us/cpguide/html/cpovrintroductiontonetframeworksdk.asp us/cpguide/html/cpovrintroductiontonetframeworksdk.asp Other relevant courses at IHA: –Windows programming (WIN1) –Komponent baseret udvikling (KPU1)

Ingeniørhøjskolen i Århus Slide 7 af 20.NET Framework Remoting strategies Two.NET Remoting strategies: –Web services for inter-business purposes Is heterogeneous across platforms and languages Supported by the.NET compact framework Relies primarily on HTTP/SOAP protocols, but may be adapted for any type of protocol Heterogeneous Is slow when used with HTTP/SOAP –.NET Remoting for intra-business purposes Is only heterogeneous across CLS languages Not supported by the.NET compact framework Relies on eiter HTTP/SOAP or TCP/Binary protocols, but may be adapted for any type of protocol Is fast when used with TCP/Binary Only heterogeneity within.NET runtime In many ways very similar to Java RMI in Java 5

Ingeniørhøjskolen i Århus Slide 8 af 20 Simplified.NET Remoting Architecture Using the classic Proxy pattern The Remoting System wraps most of the marshalling/unmarshalling work for you – like Java/CORBA Channel: Takes a stream of data and transports it to another computer or process: Default: TcpChannel & HttpChannel Channel: Takes a stream of data and transports it to another computer or process: Default: TcpChannel & HttpChannel

Ingeniørhøjskolen i Århus Slide 9 af 20 The Remoting Architecture Proxy created dynamically by the CLR. Creates a message to the server Serializes the message into a stream (SOAP or binary) Optional extra handling Writes the stream to the wire, e.g. TCP or HTTP Deserializes the message Developers are free to implement new channels or replace sink elements All server objects must be of type MarshalByRefObject or an descendant hereof Dispatch to server object

Ingeniørhøjskolen i Århus Slide 10 af 20 Remotable Objects in.NET Remoting Marshal-by-reference objects –By-reference – no state is transferred –MarshalByRefObject –Corresponds to CORBA Interface IDL and Java RMI Remote objects (UnicastRemote objects) –Proxy created Marshal-by-value objects –By-value – complete object is serialized and transferred –Implements ISerializable or decorated with Serializable Attribute [Serializable] –Very similar to Java RMI Serializable objects –Some similarity with CORBA valuetypes

Ingeniørhøjskolen i Århus Slide 11 af 20 Activation All server objects needs to be activated before a client proxy may access it Two types of activation –Server Activation (SAO) Activated when first client request arrives at server –Singleton: only one server instance for all clients –Single-call: a new server object pr. client request Lifetime is defined by server –Client Activation (CAO) Activated by the client with the CreateInstance method on the Activator object Server object only associated with creating client Lifetime is controlled by client (using leases) Very different semantics than CORBA & RMI – closer to Web services (application, session, request scope) especially SAO

Ingeniørhøjskolen i Århus Slide 12 af 20 Lifetime management.NET Remoting uses leases for lifetime management –All server objects has a lifetime lease – a time-to-live –Lease manager controls the server object leases If expired – check all sponsors (clients) performs garbage collection on server objects In DCOM –reference counting & pinging In CORBA –ORB vendor specific –Often implemented as “time since last request” In Java RMI –uses leases (similar to.NET Remoting). Clients auto-update lease at 50% Web services –Toolkit specific (HTTP primitives: Application, Session, Request) –Application scope = runs for-ever / singleton

Ingeniørhøjskolen i Århus Slide 13 af 20 Configuration Configuration: –Need to inform runtime which servers are available and at which address (URL) Two types of configuration –Programmatic (shown in example next) –Configuration file Web.config (e.g. with IIS) or Machine.config

Ingeniørhøjskolen i Århus Slide 14 af 20 Deployment Server objects may be deployed as: –Windows Form application –Windows Console application –Windows Service –Internet Information Server deployment no need for a server bootstrapping application

Ingeniørhøjskolen i Århus Slide 15 af 20 Interface Definition Design Server Stub Generation Client Stub Generation Server Coding Client Coding Server Registration Development Steps – Remoting vs. CORBA & Java RMI Java RMI: rmic RMI: JAVA J2SE JDK Start with Server Interface Coding: JAVA Start with Server Interface Coding: JAVA rmiregistry CORBA CORBA: IDL ORB RMI: JAVA interface C++, Java … CLS Interface Implicit stub gen. CLS (C# …) Remoting Configuration with CLR Remoting Configuration with CLR.NET Remoting.NET Remoting

Ingeniørhøjskolen i Århus Slide 16 af 20 Making the HelloWorld application Using Microsoft Visual Studio.NET –may of course be done with.NET Framework alone Make Client & Server solutions Server: –IHelloWorld.cs interface –HelloWorld.cs class implementation –Server.cs class implementation for boot-strapping –Add Reference to assembly System.Runtime.Remoting Client –Must add IHelloWorld.cs –Client.cs class implementation –Add Reference to assembly System.Runtime.Remoting

Ingeniørhøjskolen i Århus Slide 17 af 20 The IHelloWorld interface using System; namespace RemotingHelloServer { // IHelloWorld is the interface for the HelloWorld server class. // It is the interface that is shared across the Internet public interface IHelloWorld { string sayHello(string name); } using System; namespace RemotingHelloServer { // IHelloWorld is the interface for the HelloWorld server class. // It is the interface that is shared across the Internet public interface IHelloWorld { string sayHello(string name); } The “IDL” of.NET Remoting – similar to Java RMI

Ingeniørhøjskolen i Århus Slide 18 af 20 HelloWorld Implementation code using System; using System.Runtime.Remoting; namespace RemotingHelloServer { // HelloWorld is a server object that is available // "by-reference". It contains a constructor and a the // "sayHello" method taking a string parameter "name" public class HelloWorld : MarshalByRefObject, IHelloWorld { private string greeting; public HelloWorld() { greeting = "OOMI Christsmas greetings from the server to: "; } public string sayHello(string name) { return (greeting + name); } using System; using System.Runtime.Remoting; namespace RemotingHelloServer { // HelloWorld is a server object that is available // "by-reference". It contains a constructor and a the // "sayHello" method taking a string parameter "name" public class HelloWorld : MarshalByRefObject, IHelloWorld { private string greeting; public HelloWorld() { greeting = "OOMI Christsmas greetings from the server to: "; } public string sayHello(string name) { return (greeting + name); } Like in Java RMI (& CORBA) – we need to have an implementation of the interface A remote object “by-reference” that implements the IHelloWorld interface A remote object “by-reference” that implements the IHelloWorld interface Implementing the sayHello method Implementing the sayHello method

Ingeniørhøjskolen i Århus Slide 19 af 20 Server code – Console bootstrapping using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; namespace RemotingHelloServer { public class Server { [STAThread] static void Main(string[] args) { //Create a TCP channel TcpChannel theChannel = new TcpChannel(8085) /* Register the channel so that clients can * connect to the server */ ChannelServices.RegisterChannel(theChannel); //Register the service on the channel RemotingConfiguration.ApplicationName = "HelloWorld App"; RemotingConfiguration.RegisterWellKnownServiceType( typeof(HelloWorld), "HelloWorld App", WellKnownObjectMode.SingleCall); /*Start the server and keep it running so that clients * can connect to it. May be aborted by keypress */ System.Console.WriteLine("Press Enter to end this server process"); System.Console.Read(); } using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; namespace RemotingHelloServer { public class Server { [STAThread] static void Main(string[] args) { //Create a TCP channel TcpChannel theChannel = new TcpChannel(8085) /* Register the channel so that clients can * connect to the server */ ChannelServices.RegisterChannel(theChannel); //Register the service on the channel RemotingConfiguration.ApplicationName = "HelloWorld App"; RemotingConfiguration.RegisterWellKnownServiceType( typeof(HelloWorld), "HelloWorld App", WellKnownObjectMode.SingleCall); /*Start the server and keep it running so that clients * can connect to it. May be aborted by keypress */ System.Console.WriteLine("Press Enter to end this server process"); System.Console.Read(); } Register the channel on port 8085 Register the channel on port 8085 Register the object Register the object Like in Java RMI (& CORBA) – we need some bootstrapping code – a server process This may become a Windows NT service or a simple application, e.g. a console or Windows Form application

Ingeniørhøjskolen i Århus Slide 20 af 20 Client code – Console bootstrapping … include all the Remoting stuff namespace RemotingHelloClient { public class Client { [STAThread] static void Main(string[] args) { TcpChannel theChannel = new TcpChannel(); ChannelServices.RegisterChannel(theChannel); /* Activate the server object. Activation will bring * the server object to life, and create a proxy * stub class of the HelloWorld. In fact, as this is a * server-activated application, the call to the * server is NOT performed now, but instead waits until the * first request. It is thus the server who performs the * activation. This is the "Lazy-activation pattern" known * from e.g. CORBA */ IHelloWorld helloWorld = (IHelloWorld) Activator.GetObject( typeof(RemotingHelloServer.IHelloWorld), "tcp://localhost:8085/HelloWorld App"); System.Console.WriteLine("Please enter your name and press Enter"); string name = System.Console.ReadLine(); //Make the call string greeting = helloWorld.sayHello(name); System.Console.WriteLine("We recieved from server: "+greeting); System.Console.WriteLine("Press Enter to end"); System.Console.Read(); } … include all the Remoting stuff namespace RemotingHelloClient { public class Client { [STAThread] static void Main(string[] args) { TcpChannel theChannel = new TcpChannel(); ChannelServices.RegisterChannel(theChannel); /* Activate the server object. Activation will bring * the server object to life, and create a proxy * stub class of the HelloWorld. In fact, as this is a * server-activated application, the call to the * server is NOT performed now, but instead waits until the * first request. It is thus the server who performs the * activation. This is the "Lazy-activation pattern" known * from e.g. CORBA */ IHelloWorld helloWorld = (IHelloWorld) Activator.GetObject( typeof(RemotingHelloServer.IHelloWorld), "tcp://localhost:8085/HelloWorld App"); System.Console.WriteLine("Please enter your name and press Enter"); string name = System.Console.ReadLine(); //Make the call string greeting = helloWorld.sayHello(name); System.Console.WriteLine("We recieved from server: "+greeting); System.Console.WriteLine("Press Enter to end"); System.Console.Read(); } Create Proxy Call via Proxy object Optional (may be done implicitly)