Microsoft Dotnet Remoting.pdf

(2651 KB) Pobierz
Microsoft
12089265.001.png
Microsoft .NET Remoting
12089265.002.png
Table of Contents
Microsoft .NET Remoting..................................................................................................................1
Introduction........................................................................................................................................5
Our Audience...........................................................................................................................5
Organization.............................................................................................................................5
System Requirements..............................................................................................................7
Sample Files............................................................................................................................7
Chapter 1: Understanding Distributed Application Development................................................8
Overview..................................................................................................................................8
A Brief History..........................................................................................................................8
Distributed Architectures....................................................................................................9
Distributed Technologies..................................................................................................11
Distributed Objects—A Welcome Abstraction........................................................................12
Benefits of Distributed Application Development...................................................................13
Fault Tolerance................................................................................................................13
Scalability.........................................................................................................................14
Administration..................................................................................................................14
Challenges of Distributed Application Development..............................................................14
Performance.....................................................................................................................14
Security............................................................................................................................16
Interoperability and Wire Formats....................................................................................16
The Internet and Firewalls................................................................................................16
Configuration....................................................................................................................17
Location Independence....................................................................................................17
Object Lifetime Management...........................................................................................17
Using .NET Remoting to Meet the Challenges......................................................................18
Performance.....................................................................................................................18
Extending and Customizing Remoting.............................................................................18
Configuration....................................................................................................................18
CLR and CTS Benefits.....................................................................................................19
Interoperability..................................................................................................................20
Security............................................................................................................................21
Lifetime Managemen.......................................................................................................21
Enterprise Services..........................................................................................................21
Summary................................................................................................................................22
Chapter 2: Understanding the .NET Remoting Architecture.......................................................23
Remoting Boundaries............................................................................................................23
Application Domains........................................................................................................23
Contexts...........................................................................................................................23
Crossing the Boundaries..................................................................................................24
Object Activation....................................................................................................................27
Server Activated...............................................................................................................27
Client Activated................................................................................................................30
An Object's Lease on Life......................................................................................................31
Leases.............................................................................................................................32
Lease Manager................................................................................................................33
Sponsors..........................................................................................................................34
Crossing Application Boundaries...........................................................................................34
i
Table of Contents
Chapter 2: Understanding the .NET Remoting Architecture
Marshaling Remote Object References via an ObjRef....................................................34
Clients Communicate with Remote Objects via Proxies..................................................36
Messages Form the Basis of Remoting...........................................................................38
Channels Transport Messages Across Remoting Boundaries.........................................38
Channel Sink Chains Can Act on Messages...................................................................39
Summary................................................................................................................................42
Chapter 3: Building Distributed Applications with .NET Remoting............................................44
Overview................................................................................................................................44
Designing a Distributed Job Assignment Application.............................................................44
Implementing the JobServer Application...............................................................................45
Implementing the JobServer Application Logic................................................................45
Adding .NET Remoting....................................................................................................49
Implementing the JobClient Application.................................................................................55
Choosing a Client Application Domain.............................................................................55
Obtaining the Server's Metadata......................................................................................61
Configuring the JobClient Application for .NET Remoting...............................................63
Exposing the JobServerImpl Class as a Web Service...........................................................65
Changes to the Sample Application.................................................................................67
Using the SOAPSuds Too...............................................................................................68
Adding Security to the Web Service.................................................................................70
Using Role−Based Security with .NET Remoting............................................................72
Extending the Sample with Client−Activated Objects............................................................74
The JobNotes Class.........................................................................................................74
JobClient Application Changes........................................................................................75
Configuring the Client for .NET Remoting Client−Activated Objects...............................77
Configuring the Server for .NET Remoting Client−Activated Objects..............................79
Adding a Sponsor to the Lease........................................................................................79
Metadata Dependency Issues...............................................................................................81
Removing the JobServer's Dependency on the JobClient's Metadata............................82
Developing a Stand−In Class to Publish in Place of JobServerImpl Metadata................83
Remoting the IJobServer Interface..................................................................................84
Summary................................................................................................................................85
Chapter 4: SOAP and Message Flows...........................................................................................86
Simple Object Access Protoco..............................................................................................86
Why Should We Care About SOAP?...............................................................................86
HTTP−Based RPC...........................................................................................................87
SOAP Message Elements................................................................................................87
Document/Literal SOAP...................................................................................................89
Message Flows......................................................................................................................90
The add_JobEvent Request Message.............................................................................90
The add_JobEvent Response Message..........................................................................94
The GetJobs Request Message.......................................................................................94
The GetJobs Response Message....................................................................................95
The CreateJob Request Message...................................................................................96
The CreateJob Response Message.................................................................................96
The UpdateJobState Request Message..........................................................................97
The UpdateJobState Response Message.......................................................................97
ii
Table of Contents
Chapter 4: SOAP and Message Flows
The JobNotes Activation Request Message....................................................................98
The JobNotes Activation Response Message.................................................................99
The remove_JobEvent Request Message.....................................................................100
The remove_JobEvent Response Message..................................................................103
Summary..............................................................................................................................104
Chapter 5: Messages and Proxies...............................................................................................105
Messages.............................................................................................................................105
Construction Call Messages..........................................................................................105
Method Call Messages...................................................................................................106
Message Types..............................................................................................................106
Proxies.................................................................................................................................108
TransparentProxy...........................................................................................................108
RealProxy.......................................................................................................................109
Extending RealProxy......................................................................................................109
Custom Proxies in Practice............................................................................................109
Summary..............................................................................................................................122
Chapter 6: Message Sinks and Contexts....................................................................................123
Message Sinks.....................................................................................................................123
IMessageSink.................................................................................................................123
Synchronous Message Processing................................................................................124
Asynchronous Message Processing..............................................................................125
Understanding Contexts......................................................................................................126
Establishing a Context...................................................................................................126
Context Attributes and Properties..................................................................................127
Contexts and Remoting..................................................................................................129
Dynamic Context Sinks..................................................................................................131
Client Context Sink Chain..............................................................................................132
Server Context Sink Chain.............................................................................................133
Server Object Sink Chain...............................................................................................139
Envoy Sink Chain...........................................................................................................143
Summary..............................................................................................................................151
Chapter 7: Channels and Channel Sinks.....................................................................................152
Overview..............................................................................................................................152
How Channels Are Constructed...........................................................................................152
Channel Terminology.....................................................................................................152
HttpChannel...................................................................................................................153
HttpServerChanne.........................................................................................................155
HttpServerTransportSink................................................................................................156
HttpClientChannel..........................................................................................................157
HttpClientTransportSinkProvide....................................................................................157
HttpClientTransportSink.................................................................................................158
Creating Custom Channels..................................................................................................158
The Steps for Creating a Custom .NET Remoting Channe...........................................159
Creating the Custom Channel FileChanne....................................................................160
Implementing a Custom Channel Sink.................................................................................180
Creating the AccessTime Custom Sink..........................................................................180
iii
Zgłoś jeśli naruszono regulamin