OverView:
Distributed application is a set of components distributed across network and work as if all the components are there on the same computer. These components based technologies can be developed using DCOM, CORBA, RMI etc. These technologies are good for intranet environment. Microsoft has provided suitable framework for developing distributed application through .Net Remoting and Web Services. Remoting.net allows components to interact across application domains, processes, and machine boundaries. It enables your applications to take advantage of remote resources in a networked environment. Web Services are best suited when clients outside the firewall calling components on the server over the Internet.Remoting.Net is the best solution when clients and components are inside the firewall. It requires the client to be built using .NET which means it can’t work in heterogeneous environments. .Net Remoting uses channels (HTTP and TCP channels) to transport messages to and from remotable objects. The HTTP channel uses the SOAP protocol to transport messages which means all messages are serialized to XML. The TCP channel uses a binary stream to transport the messages. .Net Remoting supports two activation modes: Singleton and SingleCall. Singleton mode allows only one instance of an object at any time which means all requests are serviced by the single instance. You can maintain state across each request using this mode. SingleCall Mode creates a new instance of the object for each client request and are stateless. .NET Remoting when hosted with IIS, can use all the security features of ASP.NET. But you need to implement your own security features for the application if channel is hosted in the process other than aspnet_wp.exe.
When to use .Net Remoting over Web services.
Net Remoting provides distributed solution for a corporate use. So, if you need distributed environment to be implemented for internal use, .Net remoting is the best choice. If you require a faster distributed solution, .Net Remoting with TCP protocal using binary format is faster than Web services. .Net Remoting is better solution when large transfer of data is required.
What is .Net Remoting?
.Net Remoting enables communication between applications across separate domains or networks. .Net objects are exposed to remote processes to have interprocess communication. With remoting, we can use TCP or HTTP communications protocols on any port. We can use text or binary formatting. .Net Remoting supports server activated (single call and singleton) as well as client activated objects.
.Net Remoting enables communication between applications across separate domains or networks. .Net objects are exposed to remote processes to have interprocess communication. With remoting, we can use TCP or HTTP communications protocols on any port. We can use text or binary formatting. .Net Remoting supports server activated (single call and singleton) as well as client activated objects.
Describe the .Net Remoting Architecture.
.Net Remoing allows communication between server and client objects. To facilitate this, when new instance of remote object is created in the client application, the client receives reference (called proxy) to the server object. This proxy object contains references to all the methods and properties of the server object. When the client object calls any method (the call actually on proxy object), which resolves the references and invokes server object, receives the result and pass on to the client application.
What are the remotable and non-remotable objects in .Net Remoting.
The remotable objects are the objects which can be distributed accross domains, can be used with domain. The non-remotable objects are the objects which can't be distributed accross domains. In distributed system, if an object is very big, we can make it non-remotable object.
Describe the type of remotable objects in .Net Remoting.
Marshal-by-value-objects - When client calls a method on marshal-by-value-object, the remoting system creates a copy of this object and passes the copy to the client application domain. The copy hence received can handle any method call in client domain. Using Marshal-by-value-object reduces resource consuming trip across network. Marshal-by-reference-object - When client calls a method on Marshal by reference object, the remoting system create proxy object in the caller application that contains the reference of all method and properties of the object.
What are the types of activation modes in .Net remoting?
Server Activation Mode: In this mode, objects are created on the server when we call a method in the server class and not when we create instance using new. In this type of scenario, the client is always connected with server but the services are activated only when we call the method of the server class. We can create server activated object as a Singleton or SingleCall object. If we create server object as singleton, a single instance will manage all the clients. If we create server object as singlecall, the remoting system creates object each time a client method invokes a remote object.
Client Activation Mode: This object gets created when we create instance using new keyword. In this mode, client application domain defines the lifetimes of client activated objects. The client domain defines the lifetimes of client-activated objects. They use lifetime leases to determine the duration of their existence and after the lifetime expires, the object is marked for GC.
Describe the term Channel in .Net Remoting.
In .Net Remoting, an application use Channel to send message to another application which is runing in different domain or process. Before sending message, Channel converts message into appropriate format like XML or binary format. The channel that carries message(Mashalled parameter) can use protocal like TCP and HTTP. Channel can be HTTPChannel and TCPChannel. The HTTPChannel use soapFormatter to serialize messages into the XML format using SOAP protocal. Using SOAP method allows the client to call method on the remote object that might not be using .Net framework. The TCPChannel use binaryFormatter to serialize message into binary stream.
In .Net Remoting, an application use Channel to send message to another application which is runing in different domain or process. Before sending message, Channel converts message into appropriate format like XML or binary format. The channel that carries message(Mashalled parameter) can use protocal like TCP and HTTP. Channel can be HTTPChannel and TCPChannel. The HTTPChannel use soapFormatter to serialize messages into the XML format using SOAP protocal. Using SOAP method allows the client to call method on the remote object that might not be using .Net framework. The TCPChannel use binaryFormatter to serialize message into binary stream.
How does .Net Remoting works?
Remoting.Net allows components to interact across application domains, processes, and machine boundaries, thus allows applications to access remote resources in a networked environment. The interaction of components is made possible through proxy in remoting architecture. When a client calls the remote method, it’s the proxy that receives the call. The proxy then encodes the message using formatter. The messages are then sent over the channel to the server process where listening channel receives the call and passes it to the remoting system. The requested method is then invoked and results are returned back to the client.
.Net Remoting provides an infrastructure where objects of different AppDomains can interact. A client interacts with server object using .Net Remoting architecture. An object interacts with other objects outside AppDomains using proxy since the objects can't access directly anything outside AppDomain.
Point to be noted.A remote object is implemented by inheriting MarshalByRefObject class.A client has to obtain proxy activating a remote object by calling CreateInstance, GetObject, or new.Local objects can be passed as parameters when making remote calls. Local objects are passed by value in a remote call.The object passed as parameter in a remote call must be serialized.
Activation ModelYou need to activate remote object before use. There are two activation modes in .Net RemotingServer Activation In this mode, objects are created automatically when a client attempts to access the object. The object doesn't get created when you use new keyword to create instance of the server class. Client ActivationIn this mode, objects are created when you use new keyword to create instance of the server class.
A server object is created and deployed on the network that serves client requests. The server objects have to be registered with the CLR before it can be accessed by client. The details that have to be provided to the CLR are
Name of the assembly that should be loaded to activate the objectThe namespace and type name of the objectThe name of the endpoint where the object can be accessed The channels to be used by client to communicate have to be registered.The registered channels then start listening for clients to connect.
Once a remote object has been deployed, clients can connect and invoke methods on the server object.
In order to access remote object, the client first activates the object by calling new, GetObject, or CreateInstance. On activation request, a proxy is created to represent the remote object. The client message in the serialized form is transported to the server. The type of serialization depends on the channel. For example, when the HTTP channel is used, all messages are serialized to XML and transported over SOAP. On the other hand, TCP uses binary serialization.
On the server side, the requested method is then invoked and results are packaged in a message and returned back by to the client. If the target object is of type SingleCall, it will automatically be garbage collected after the call completes.
Remoting.Net allows components to interact across application domains, processes, and machine boundaries, thus allows applications to access remote resources in a networked environment. The interaction of components is made possible through proxy in remoting architecture. When a client calls the remote method, it’s the proxy that receives the call. The proxy then encodes the message using formatter. The messages are then sent over the channel to the server process where listening channel receives the call and passes it to the remoting system. The requested method is then invoked and results are returned back to the client.
.Net Remoting provides an infrastructure where objects of different AppDomains can interact. A client interacts with server object using .Net Remoting architecture. An object interacts with other objects outside AppDomains using proxy since the objects can't access directly anything outside AppDomain.
Point to be noted.A remote object is implemented by inheriting MarshalByRefObject class.A client has to obtain proxy activating a remote object by calling CreateInstance, GetObject, or new.Local objects can be passed as parameters when making remote calls. Local objects are passed by value in a remote call.The object passed as parameter in a remote call must be serialized.
Activation ModelYou need to activate remote object before use. There are two activation modes in .Net RemotingServer Activation In this mode, objects are created automatically when a client attempts to access the object. The object doesn't get created when you use new keyword to create instance of the server class. Client ActivationIn this mode, objects are created when you use new keyword to create instance of the server class.
A server object is created and deployed on the network that serves client requests. The server objects have to be registered with the CLR before it can be accessed by client. The details that have to be provided to the CLR are
Name of the assembly that should be loaded to activate the objectThe namespace and type name of the objectThe name of the endpoint where the object can be accessed The channels to be used by client to communicate have to be registered.The registered channels then start listening for clients to connect.
Once a remote object has been deployed, clients can connect and invoke methods on the server object.
In order to access remote object, the client first activates the object by calling new, GetObject, or CreateInstance. On activation request, a proxy is created to represent the remote object. The client message in the serialized form is transported to the server. The type of serialization depends on the channel. For example, when the HTTP channel is used, all messages are serialized to XML and transported over SOAP. On the other hand, TCP uses binary serialization.
On the server side, the requested method is then invoked and results are packaged in a message and returned back by to the client. If the target object is of type SingleCall, it will automatically be garbage collected after the call completes.
Approaches to access server objects in Remoting.Net
First one to have copy of server object on the client machine and accessing local copy of object to call method. This method is good suited when the object is not very big not having too many methods. Copying big object is wastage of client resources which includes network resources and processing time. The second approach is to create a proxy object that returns reference of all the methods and properties of server object in the client domain. The proxy acts as local object, fake server object on the client machine. Any method call from the client will be served by proxy which in turn access server domain to get response from server object. This approach is good when the object is big with many methods.
No comments:
Post a Comment