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

1 / 57
About This Presentation
Title:

How to Develop Distributed Applications using .NET Remoting

Description:

MSDN Magazine. MSDN News. MSDN Subscriptions. THE way to get Visual Studio .NET. Visual Studio .NET ... Become A Microsoft Certified Solution Developer. What Is MCSD? ... – PowerPoint PPT presentation

Number of Views:488
Avg rating:3.0/5.0
Slides: 58
Provided by: sean163
Category:

less

Transcript and Presenter's Notes

Title: How to Develop Distributed Applications using .NET Remoting


1
Develop Distributed Applications using .NET
Remoting
Loke Uei Developer Evangelist Microsoft Malaysia
2
What we will cover
  • Introduction to .NET Remoting
  • Not Exhaustive
  • DCOM vs. Remoting
  • Configuring .NET Remote Applications
  • Hosting .NET Remote Applications

3
Session Prerequisites
  • Experience With the Following
  • .NET Framework
  • Visual C, VB .NET, or C
  • Web Services
  • Distributed Computing Concepts

Level 200
4
So Why This Presentation?
  • 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.

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

6
Architecture and TerminologyInto to Remoting
  • Communication between Application Domains
  • Usually Between Servers
  • Protect IP / Source Code
  • Replacement for DCOM
  • Low Level Control

7
Architecture and Terminology Remoting Terminology
  • Application Domains
  • Channels
  • Formatters (SOAP / Binary)
  • Server Activated Objects (Wellknown)
  • Client Activated Objects

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

9
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

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

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

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

13
Demonstration 1 Simple Demo Concepts
14
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting

15
Web Services/DCOM 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

16
Web Services/DCOM DCOM
  • Remoting
  • DCOM
  • Choose Protocol
  • Create Protocol
  • Firewall Friendly
  • Custom Ports
  • Define Protcol
  • Tighter Security
  • Custom
  • IIS
  • NT
  • RPC Protocol
  • Not Firewall Friendly
  • Pings for Lifetime

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

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

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

20
Server Activated ObjectsSingleCall
  • Object Created On Each Call
  • One Instance Per Client Request
  • No State
  • Server Farm Friendly
  • ltwellknown ModeSingleCall/gt

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

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

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

24
Demonstration 2Server Activated Objects
SinglecallSingletonUtilizing State
25
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting

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

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

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

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

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

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

32
Demonstration 3CAO DemoCAO DemoLease
DemoMaintain StateTracking Remote Actions
33
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting

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

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

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

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

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

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

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

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

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

43
Demonstration 4Configuration Programmatic -
Client Programmatic - Server
44
Agenda
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting

45
Hosting Hosting Options
  • Console Applications
  • Windows Forms Applications
  • IIS
  • Windows NT Service

46
Hosting IIS and Windows Services
  • IIS
  • Built In
  • Security
  • Stable
  • Windows Service
  • Roll Your Own
  • More Flexible

47
Hosting IIS Configuration
  • Use Configuration File Web.Config
  • Remote Object - /bin Directory
  • Place in Global Assembly Cache (Gacutil.exe)
  • Must Use HttpChannel
  • Can Use Binary Formatter
  • Object URI ends in .rem or .soap

48
Hosting Windows Service
  • Project Built Into Visual Studio .NET
  • Services.msc MMC Snap-in
  • Any Channel Format
  • HttpChannel
  • TcpChannel
  • Configuration
  • Programmatic
  • File

49
Demonstration 5Hosting Demo Windows Service
50
Session Summary
  • Architecture and Terminology
  • Web Services/DCOM Comparison
  • Server Activated Objects (SAO)
  • Client Activated Objects (CAO)
  • Configuration
  • Hosting

51
For More Information
  • MSDN Web site at
  • msdn.microsoft.com
  • Got Dot Net
  • www.gotdotnet.com
  • ASP .NET
  • www.asp.net

52
For More Information
  • Dot Net Remoting
  • www.dotnetremoting.cc
  • ASP .NET Directory
  • www.123aspx.com

53
MS PressEssential Resources for Developers
To find the latest developer related titles
visit www.microsoft.com/mspress
54
MSDNEssential Resources for Developers
Subscription Services
Library, OS, Professional, Enterprise, Universal
Delivered via CD-ROM, DVD, Web
OnlineInformation
MSDN Online, MSDN Flash
Training Events
MSDN Training, Tech-Ed, PDC, Developer Days,
MSDN/Onsite Events
Print Publications
MSDN Magazine MSDN News
MembershipPrograms
MSDN User Groups
55
MSDN Subscriptions THE way to get Visual Studio
.NET
MSDN Subscriptions
Visual Studio .NET
  • Enterprise Architect
  • Software and data modeling
  • Enterprise templates
  • Architectural guidance

MSDN Universal2799 new2299 renewal/upgrade
  • Enterprise Developer
  • Enterprise lifecycle tools
  • Team development support
  • Core .NET Enterprise Servers

MSDN Enterprise2199 new1599 renewal/upgrade
NEW
  • Professional
  • Tools to build applications and XML Web services
    for Windows and the Web

MSDN Professional1199 new899 renewal/upgrade
56
Where Can I Get MSDN?
  • Visit MSDN Online atmsdn.microsoft.com
  • Register for the MSDN Flash Email Newsletter at
  • msdn.microsoft.com/flash
  • Become an MSDN CD Subscriber at
    msdn.microsoft.com/subscriptions
  • MSDN online seminars
  • msdn.mircosoft.com/training/seminars
  • Attend More MSDN Events

57
Become A Microsoft Certified Solution Developer
  • What Is MCSD?
  • Premium certification for professionals who
    design and develop custom business solutions
  • How Do I attain MCSD Certification?
  • It requires passing four exams to prove
    competency with Microsoft solution architecture,
    desktop applications, distributed application
    development, and development tools
  • Where Do I Get More Information?
  • For more information about certification
    requirements, exams, and training options, visit
    www.microsoft.com/mcp

58
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com