remotingc_-v2-blog

Shared by: erdgsekhar
Categories
Tags
-
Stats
views:
9
posted:
9/29/2009
language:
English
pages:
20
Document Sample
scope of work template
							.NET Remoting

Distributed Apps
Communication between multiple server applications or services in the network
Must be capable to run behind firewalls Some share common protocols (SOAP, WSDL), but not a common platform Some share common protocols and common platform (e.g., .NET)

.NET Distributed Apps
Between .NET and non- .NET nonUse Web Service Protocols
HTTP, SOAP, WSDL

Between .NET Applications
Use the rich object fidelity of the .NET programming languages Use Binary Communication where possible
High speed

Use Web Service Protocols if needed
HTTP to communicate through firewalls

.NET To .NET
Rich Object Fidelity Whatever you can represent in C#, Visual Basic .NET or CLS compliant compiler can be remoted Class, Class Hierarchy, Interfaces Fields, Properties, Methods, Events, Delegates DataSet, List, etc

.NET Remoting Architecture
Formatter
X = Add(5, 2)

Proxy

Your Binary Channel Binary SOAP HTTP SOAP TCP Channel

Dispatcher

Int Add(int x, int y)

Log

Extensible Architecture
Interception
Proxies – Turn call stackframe into Message Dispatcher – Turn message into stack frame and calls the object

Formatters
Turn message into byte stream SOAP – fully SOAP 1.1 compliant Binary – high speed and fidelity for .NET to .NET (also own)

Extensible Architecture
Channels
Transport byte streams HTTP – good for firewalls and http proxy servers TCP – high speed socket communication You can roll your own

Programming Model Object styles and lifetimes
SAO – SingleCall and Singleton Client activated objects
Instance created for each “new” Lease based lifetime

Remote call types
Synchronous Asynchronous

Creating Remote Objects
Managed objects can be remoted
By Value or By Reference Including complex types, arrays, structs, datasets

Developer decides how object is marshaled Marshal By reference
Objects lives on server Extend System.MarshalByRefObject or derived class Object state copied when marshaled Class must be serializable
Add [Serializable] custom attribute Optionally support ISerializable

Marshal By Value

.Net Remoting Activation
Server Activated, Single Call Server Activated, Singleton Client Activated

ClientClient-Activated

“Owned” instance

Server Activated, Single Call

Single Calls

Server Activated, Singleton

Single Instance

Hosting Remote Objects
Hosting with IIS
Create IIS application Place Assemblies in bin directory Add web.config file to application root

Hosted with User Application
Create an exe application or service Call RemotingConfiguration.Configure to configure application as a host Start the host

Host Configuration files
In web.config or host config file Wellknown objects can be SingleCall or Singleton Type must be typename, assembly ObjectUri must end with .soap or .rem
<service> <wellknown mode="SingleCall" type="Hello.HelloService, Hello" objectUri="HelloService.soap“/> </service>

Activating Remote Services
Use any of these 3 techniques
1. 2. 3.

Use client config file and new operator Register type and new operator Use Activator.GetObject

Using Client Config Files
Easy and Flexible Configuration Can be changed without recompile Select channel and formatter After loading config file, just use new
<client> <wellknown type="Hello.HelloService, Hello" url="http://localhost/RemotingHello/HelloService.soap" /> </client> … RemotingConfiguration.Configure(configFilename); HelloService helloService = new HelloService();

Register Well Known Type
No Config File necessary Requires recompile to change uri After registering type, just use new
Type type = typeof(HelloService); String url = “http://localhost/RemotingHello/HelloService.soap"; ChannelServices.RegisterChannel( new TcpChannel() ); RemotingConfiguration.RegisterWellKnownClientType( type, url ); HelloService helloService = new HelloService();

Using Activator
Use Activator.GetObject to get instance Doesn’t use new operator

Type type = typeof(HelloService); String url = "http://localhost/RemotingHello/HelloService.soap";
HelloService helloService = (HelloService) Activator.GetObject(type, url);

Summary
Consistent programming model Full Object fidelity SingleCall, Singleton, Client Activated Synchronous and Asynchronous calls
via delegates

Extensible Channel, formatters IIS and user hosting


						
Related docs
Other docs by erdgsekhar
Er Diagram Pdf
Views: 232  |  Downloads: 4
web-services
Views: 59  |  Downloads: 11
aspdotnet-architecture1
Views: 3  |  Downloads: 1
abstract-c_-blog
Views: 5  |  Downloads: 0
C# .net
Views: 52  |  Downloads: 1
remotingc_-v2-blog
Views: 9  |  Downloads: 0
dataset-demo-handout
Views: 1  |  Downloads: 0
oops-in-c_
Views: 33  |  Downloads: 14
aspnet-exercizes
Views: 93  |  Downloads: 3