How to Develop Distributed Applications using 'NET Remoting - PowerPoint PPT Presentation

1 / 51
About This Presentation
Title:

How to Develop Distributed Applications using 'NET Remoting

Description:

Futures. Architecture and Terminology. Intro to Remoting ... Futures. Client Activated Objects. Client Activated Object (CAO) Created by Calling Client ... – PowerPoint PPT presentation

Number of Views:345
Avg rating:3.0/5.0
Slides: 52
Provided by: sean164
Category:

less

Transcript and Presenter's Notes

Title: How to Develop Distributed Applications using 'NET Remoting


1
Develop Distributed Applications using .NET
Remoting
Kate Gregory Regional Director Gregory Consulting
Limited kate_at_gregcons.com
2
What we will cover
  • Introduction to .NET Remoting
  • Not Exhaustive
  • Compare to DCOM and Web Services
  • Configuring .NET Remote Applications
  • Hosting .NET Remote Applications
  • What about Indigo?

3
Who likes DCOM?
  • You know DCOMs a pain if
  • You've ever wanted to control the channel or
    format, or anything else about the DCOM messages.
  • You've ever wanted to trace or log DCOM messages.
  • You've wanted to easily use DCOM over the
    internet with a variety of clients.
  • Youve ever wanted to quickly change
    configuration settings such as ports and channels.

4
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting
  • Futures

5
Architecture and TerminologyIntro to Remoting
  • Communication between Application Domains
  • Usually Between Servers
  • Replacement for DCOM
  • Low Level Control

6
Architecture and Terminology Remoting Terminology
  • Application Domains
  • Channels
  • Formatters
  • Server Activated Objects (Wellknown)
  • Client Activated Objects

7
Architecture and Terminology Application Domains
  • Process Boundary
  • Provides Isolation
  • Provides Protection
  • Security

8
Architecture and Terminology Channels
  • Transport Data
  • Two Default Formats- http// or tcp//
  • Http// - good for firewalls
  • Tcp// - high speed, binary
  • Port Agnostic
  • Create Your Own

9
Architecture and Terminology Formatters
  • Turn Message Into Stream
  • Binary
  • Soap 1.1 Compliant

10
Architecture and Terminology .NET to Non-.NET
  • SOAP 1.1 Specification
  • Http//
  • Simple Datatypes
  • int
  • float
  • string

11
Architecture and Terminology.NET to .NET
  • Rich Functionality
  • Almost any CLS Object
  • DataSets
  • Hashtables
  • Custom Objects
  • Binary
  • Fast

12
Demo 1
  • Remoting Concepts

13
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting
  • Futures

14
Web Services
  • Remoting
  • Web Services
  • Any Application
  • IIS
  • WinForm
  • Windows Service
  • Console Application
  • Multiple Protocols
  • Http//
  • Tcp//
  • Custom
  • Binary or Soap
  • Only IIS
  • Only Http//
  • WSDL

15
DCOM
  • Remoting
  • DCOM
  • Choose Protocol
  • Create Protocol
  • Firewall Friendly
  • Custom Ports
  • Define Protocol
  • Tighter Security
  • Custom
  • IIS
  • NT
  • RPC Protocol
  • Not Firewall Friendly
  • Pings for Lifetime

16
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting
  • Futures

17
Server Activated ObjectsServer Activated Objects
  • Well-known
  • SingleCall
  • Singleton
  • Marshaling
  • Configuration

18
Server Activated ObjectsWell-Known
  • Client Must Know The Endpoint
  • Server Controls Object
  • ltwellknowngt
  • RegisterWellKnownServiceType()

19
Server Activated ObjectsSingleCall
  • Object Created On Each Call
  • One Instance Per Client Request
  • No State
  • Server Farm Friendly
  • modeSingleCall

20
Server Activated ObjectsSingleton
  • One Object On Server
  • Has Lifetime
  • Default 5 Minutes
  • Can Override
  • Shared Between Multiple Clients

21
Server Activated ObjectsMarshaling
  • Marshall by Value
  • Object Serialized
  • Attribute Serializable
  • Implement ISerializable
  • Marshall by Reference
  • Inherit System.MarshalByRefObject
  • Proxy Class

22
Server Activated ObjectsServer Configuration
  • Config file
  • ltwellknown
  • modeSingleCall or Singleton
  • typetype,assembly
  • objectUrimyobject /gt
  • Programmatic
  • Create Wellknown Type
  • Register

23
Demo 2
  • Single Call vs Singleton
  • State

24
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting
  • Futures

25
Client Activated Objects Client Activated Object
(CAO)
  • Created by Calling Client
  • Client Controls Lifetime
  • Lease
  • State For Individual Client
  • Tracking Services

26
Client Activated Objects Client Activation
  • New()
  • Configuration File
  • ltactivated /gt
  • Activator.CreateInstance()
  • Overloaded
  • Pass In Url, Assembly Attributes

27
Client Activated Objects Configuration
Properties
  • Config file
  • ltactivated
  • type"type,assembly" /gt
  • Programmatic
  • UrlAttribute
  • Activator.CreateInstance

28
Client Activated Objects Lease
  • In DCOM Ping
  • High Overhead
  • Not Suited for Internet
  • Remoting - Lease-based Mechanism
  • Set Default Lifetime (min, sec, etc..)
  • Sponsors Renew

29
Client Activated Objects Properties
  • Lease Time
  • Default 5 Minutes
  • Set 0 to Infinite
  • Sponsors
  • Listens from Server Application
  • GetLifeTimeService()
  • Renewal()

30
Client Activated Objects Tracking
  • Implement ITrackingHandler
  • DisconnectedObject ()
  • MarshaledObject ()
  • UnmarshaledObject ()
  • RegisterTrackingHandler( ITrackingHandler)

31
Demo 3
  • Client Activated Objects
  • Lease
  • State

32
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting
  • Futures

33
Configuration File Configuration
  • XML
  • Easy To Read
  • Easy To Modify
  • Simple To Code
  • No Need to Recompile

34
Configuration File Format
  • ltconfigurationgt
  • ltSystem.Runtime.Remotinggt
  • ltapplicationgt
  • lt/applicationgt
  • lt/System.Runtime.Remotinggt
  • lt/configurationgt

35
Configuration File - Well-known Objects
  • ltservicegt
  • ltwellknown
  • typeNamespace.Class, Assembly
    objectUriData modeSingleton /gt
  • lt/servicegt

36
Configuration File - Client Activiated Objects
  • ltservicegt
  • ltactivated typeNamespace.Class, Assembly /gt
  • lt/servicegt

37
Configuration RemotingConfiguration Class
  • Configure(configuration file)
  • Method works for server and client configuration

38
Configuration Programmatic Configuration
  • Hide Property Information
  • Required Recompile
  • Dynamic
  • Easy To Deploy

39
Configuration Programmatic Configuration
  • Create Channel
  • Register Channel
  • Create Remote Object
  • Register Object with Remoting Configuration

40
Configuration Programmatic Configuration -
Server
  • ChannelServices.RegisterChannel(new
    HttpChannel(8080))
  • RemotingConfiguration.ApplicationName "Data"
  • RemotingConfiguration.RegisterWellKnownServiceTyp
    e(typeof(RemoteObject.DataAccess),"Data",
    WellKnownObjectMode.SingleCall)

41
Configuration Programmatic Configuration -
Client
  • ChannelServices.RegisterChannel(new
    TcpServerChannel( 6789 ) )
  • ActivatedServiceTypeEntry obj new
    ActivatedServiceTypeEntry( "RemoteObject.DataAcces
    s", "RemoteObject")
  • RemotingConfiguration.RegisterActivatedServiceTyp
    e( obj )

42
Demo 4
  • Programmatic Configuration

43
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting
  • Futures

44
Hosting
  • Application
  • Console
  • Windows
  • Start and Stop by hand
  • Can display or control information
  • IIS
  • Windows Service

45
Demo 5
  • Hosting in IIS
  • Hosting in a Service

46
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting
  • Futures

47
Other Cool Remoting Tricks
  • Raise an event on the server
  • Handle it in a client
  • Pass a parameter to the handler by reference
  • Get a response from the client that the event was
    handled
  • Publish-subscribe server does not managed list
    of clients

48
Web Services vs. Remoting
  • Web Services
  • XML (SOAP) interfaces to binary objects
  • Text-based ideal for HTTP etc.
  • Standardized messaging protocol
  • Lightweight, easily deployable and accessible
  • .NET Remoting
  • Binary proxy - stub model
  • Still SOAP 1.1 compatible
  • High performance
  • Binary streams, still configurable over HTTP
    channel
  • Proprietary
  • .NET required at both ends for straightforward use

49
The (not so distant) future!Indigo
50
Secure, Reliable, Transacted Visual Studio .NET
class HelloService WebMethod public
String Hello(String Greeting)
X509CertificateCollection collection new
X509CertificateCollection() IntPtr blob
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CRYPTOA
PI_BLOB))) IntPtr data
(IntPtr)((int)blob Marshal.SizeOf(typeof(CRYPTOA
PI_BLOB))) SeqAckRange range new
SeqAcknRange(id, low, high ) SeqAckRange
ranges range ReliableQueue.ProcessAcks(
ranges ) hr pITxDispenser-gtBeginTransaction
(NULL, ISOLATIONLEVEL_SERIALIZABLE, 0,
pITxOptions, pITransaction) return
Greeting
51
Secure, Reliable, Transacted Web Service
Enhancements
class HelloService WebMethod public
String Hello(String Greeting) foreach (
SecurityToken tok in requestContext.Security.Token
s X509SecurityToken token tok as
X509SecurityToken SeqAckRange range new
SeqAcknRange(id, low, high ) SeqAckRange
ranges range ReliableQueue.ProcessAcks(
ranges ) hr pITxDispenser-gtBeginTransaction
(NULL, ISOLATIONLEVEL_SERIALIZABLE, 0,
pITxOptions, pITransaction) return
Greeting
52
Secure, Reliable, Transacted Indigo
Confidentiality Reliability(Guarantees.ExactlyO
nce Guarantees.InOrder) Service class
HelloService TransactionCoupling(
TransactionCouplingOptions.Required)
ServiceMethod String Hello(String Greeting)
return Greeting
53
Windows CommunicationCode Named Indigo
  • Advanced web services
  • Secure, reliable, transacted
  • Heterogeneous interoperability
  • Powerful messaging capabilities
  • Programming model extends existing capabilities
  • Simplifies building services

Service Model
MessagingServices
Instance Manager
Context Manager
TypeIntegration
ServiceMethods
DeclarativeBehaviors
TransactedMethods
Queue
Router
Connector
Topic
Channels (Datagram, Reliable, Peer, )
Policy Engine
Framework

Channel Security
Transport Channels (IPC, HTTP, TCP)
SystemServices
Message Encoder
Communications Manager (Port)
Transactions
Federation
Hosting Environments

ASP.NET
.container
.exe
NT Service
DllHost
CLR
Network Class Library
Serialization
Demand Activation and Process Health - IIS
Network Services
Identity and Security System
PNRP
Native WiFi
SIP
TCP Listener
UDPListener
IPCListener
Transactions
Internet Connection Firewall
Protocols
IO Manager
Filter Engine
TCP, UDPIPV4, IPV6
QOS
IPSEC
HTTPListener
Kernel Mode
Device and File System Drivers

802.3

802.11
Write a Comment
User Comments (0)
About PowerShow.com