What is Remoting in .Net ?
I was hearing the word for long time but never could understand completely,
was bit afraid too. Only thing that i understood about remoting is that
"Remoting is Distributed Architecture in .net", after giving a few try finally
i am able to implement remoting successfully.
If a person like me can understand remoting, I can tell that
each one of you can become a master of remoting. its really Fun.
So, before i start with a realltime implementation, i would like you to familer with few remoting key concepts.
Three major thing of remoting application are :
1. Remote Object Design and Chanel Registration.
2. Host Server.
3. Atleaset one Client.
any developer can develope any of the above component easily, only the tricks
remain in implementation. how to implement !!
Now let's look at the code sample.
|
|
| Remoting Client |
| Here is how we can configure the client to use the remoting service, file should be called "Client.exe.config" |
 | Client configuration sample [Client.exe.config] |
| <configuration>
| | 1: <system.runtime.remoting>
| | 2: <application>
| | 3: <channels>
| | 4: <channel name="COBRemotingClient" useDefaultCredentials="false" ref="http" >
| | 5: <clientProviders>
| | 6: <formatter ref="soap"/>
| | 7: </clientProviders>
| | 8: <serverProviders>
| | 9: <provider ref="wsdl" />
| | 10: <formatter ref="soap" typeFilterLevel="Full"/>
| | 11: </serverProviders>
| | 12: </channel>
| | 13: </channels>
| | 14:
| | 15: </application>
| | 16: </system.runtime.remoting>
| | 17:</configuration>
| | 18: |
|
|
| Now the time to consume the service at client ...lets look at the code below. |
 | Rmoting configuartion sample |
| using System;
| | 1:using System.Collections.Generic;
| | 2:using System.Text;
| | 3:using System.Configuration;
| | 4:using System.Runtime.Remoting;
| | 5:using System.Runtime.Remoting.Channels;
| | 6:using System.Runtime.Remoting.Channels.Http;
| | 7:using System.Runtime.Serialization.Formatters.Binary;
| | 8:using System.Runtime.Serialization.Formatters.Soap;
| | 9:using System.Runtime.Remoting.Proxies;
| | 10:using MyRemoteObjectDefination;
| | 11:using ServiceEntities;
| | 12:
| | 13:namespace MyRemoting.Client
| | 14:{
| | 15: public class MyClientObject
| | 16: {
| | 17: public MyClientObject()
| | 18: {
| | 19:
| | 20: }
| | 21:
| | 22: public ServiceEntities.BusinessException GetExceptionDetails()
| | 23: {
| | 24: //Create Service class object
| | 25: IBusinessException svc = (IBusinessException)Activator.GetObject(typeof(IBusinessException), "http://" + Util.Instance.RemoteServer + ":80/COBRemote/BusinessExceptionSummary.soap");
| | 26:
| | 27:
| | 28: //Get B.Exception details
| | 29: return svc.GetExceptionDetails();
| | 30:
| | 31:
| | 32: }
| | 33: }
| | 34:}
| | 35: |
|
|
Asp.net, Ado.net, .Net Remoting, .Net
Webservice, SQL, XML, XSLT, WCF, WPF, WWF NHibernate, Ajax, Jquery, DHTML