This is a discussion on When would we use .NET Remoting and when Web services? within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi all, When would we use .NET Remoting and when Web services?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all, When would we use .NET Remoting and when Web services?
__________________ Krishnakumar.S Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily |
| Sponsored Links |
| |||
| Hi, Use remoting for more efficient exchange of information when you control both ends of the application. Use Web services for open-protocol-based information exchange when you are just a client or a server with the other end belonging to someone else.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| oh..great vinoth, thnx for your reply... Do u know What are remotable objects in .NET Remoting?
__________________ Krishnakumar.S Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily |
| |||
| How does .NET Remoting work? .NET remoting involves sending messages along channels. Two of the standard channels are HTTP and TCP. TCP is intended for LANs only - HTTP can be used for LANs or WANs (internet). Support is provided for multiple message serializarion formats. Examples are SOAP (XML-based) and binary. By default, the HTTP channel uses SOAP (via the .NET runtime Serialization SOAP Formatter), and the TCP channel uses binary (via the .NET runtime Serialization Binary Formatter). But either channel can use either serialization format. There are a number of styles of remote access: SingleCall: Each incoming request from a client is serviced by a new object. The object is thrown away when the request has finished. This (essentially stateless) model can be made stateful in the ASP.NET environment by using the ASP.NET state service to store application or session state. Singleton: All incoming requests from clients are processed by a single server object. Client-activated object: This is the old stateful (D)COM model whereby the client receives a reference to the remote object and holds that reference (thus keeping the remote object alive) until it is finished with it. Using Web Application as Client we can embed config file with webconfig file Using Web Application as Client For creating web application as client, Take .NET IDE-> New Project named "RemotingWebClient" Type ASP.NET Web application. Take web.config and replace this file. <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation defaultLanguage="c#" debug="true" /> <customErrors mode="RemoteOnly" /> <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /> <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="20" /> <globalization requestEncoding="utf-8" responseEncoding="utf-8" /> </system.web> <system.runtime.remoting> <application> <client> <wellknown type="MohamedAshraf.Samples.MyRemoteObject,Mohamed Ashraf.Samples" url="tcp://localhost:8000/MyRemoteObject"/> </client> <channels> <channel ref="tcp" port="0"> <clientProviders> <formatter ref="binary"/> </clientProviders> </channel> </channels> </application> </system.runtime.remoting> </configuration> RemotingWebClient.cs using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Runtime.Remoting; using MohamedAshraf.Samples; namespace RemotingWebClient { /// <summary> /// Summary description for WebForm1. /// </summary> public class RemotingWebClient : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { RemotingConfiguration.Configure(Server.MapPath("." ) + "\Web.config"); MyRemoteObject robj =new MyRemoteObject(); Response.Write(robj.Hello()); } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } } ow to run it? Console application as server and client: Run the SimpleServer.exe then run SimpleClient.exe. Console application as server and web as client : Run the SimpleServer.exe the run RemotingWebClient.aspx. Window service as web service and web as client :Start window service thenrun SimpleClient.exe or RemotingWebClient.aspx |
| |||
| Hmm...great article about .Net Remotting.... Krishna... Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed. |
| |||
| krishna... Here is a small explonation about the proxy of the server object in .NET Remoting: It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling. ![]()
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Hi Krishna.... then a small walk through ....channels in .NET Remoting: Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| .NET Remoting | S.Vinothkumar | C# Programming | 14 | 10-04-2007 07:41 AM |
| security measures for .NET Remoting | Arun | ASP and ASP.NET Programming | 1 | 08-18-2007 12:15 AM |
| What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services | Arun | ASP and ASP.NET Programming | 1 | 08-09-2007 07:56 AM |
| What is .NET Remoting ? | oxygen | ASP and ASP.NET Programming | 4 | 08-08-2007 02:37 AM |
| Flash Remoting | nssukumar | Flash Actionscript Programming | 3 | 03-20-2007 05:28 AM |