About us |  Help us improve
intelliVERB - Get a fair search of the Internet !
Visual studio .net
SQL Server
Oracle
Main  >  Remoting Email this page to friend
Activation component
Client component
Configuration file
Server component
 
 
 
 
 
C#Configuration fileTop
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <system.runtime.remoting>
  <application>
   <service>
   <wellknown mode="Singleton"
        type="UseRemoting, UseRemoting"
        objectUri="DoAll"/>
   </service>
   <!--Channel to be use to receive messages from clients-->
   <!--Set ref:http to HTTP protocol to transport messages-->
   <!--Specify ref:tcp to use TCP channel instead-->
   <!--the HttpServerChannel object will listen at port 1001-->
   <channels>
    <channel ref="http"
       port="1001"/>
   </channels>
  </application>
 </system.runtime.remoting>
</configuration>

C#Server componentTop
Using System;
namespace DoAllApp
{
 
 public class UseRemoting:MarshalByRefObject
 {
  public UseRemoting()
  {
   
  }
  public bool LogUserRequest(string UserId,string RequestMessage)
  {
   //TODO: call log library to do instructions
   return true;
  }
 }
}

C#Activation componentTop

Using System.Runtime.Remoting;
Using System.Runtime.Remoting.Channels;
Using System.Runtime.Remoting.Channels.Http;

namespace DoAllApp
{
 
 public class ActivateRemoting
 {
  private staticUseRemoting UseEventLog eLog1;

  public static void Main(string[] Args)
  {
   eLog1=new UseEventLog("ActivateRemoting","Application Log");
   //Configure our remote component using our configuration file
   RemotingConfiguration.Configure("UseRemoting.config");
   //Configure our remote component programatically
   /*
   RemotingConfiguration.ApplicationName="UseRemoting";
   ChannelServices.RegisterChannel(new HttpChannel(1001));
   RemotingConfiguration.RegisterWellKnownServiceType(
    typeof(UseRemoting),"DoAll",WellKnownObjectMode.Singleton);
   */
   /*
    WellKnownObjectMode.SingleCall: The remoting system will
    create an object each time a client method invokes a
    remote object
    WellKnownObjectMode.Singleton: The remoting system
    will have only one instance regardless of the number
    of clents
    */

   eLog1.LogMessage("The remoting host application is up running");
  }
 }
}


C#Client componentTop

Using System;
Using System.Runtime.Remoting;
Using System.Runtime.Remoting.Channels;
Using System.Runtime.Remoting.Channels.Http;

namespace DoAllApp
{
 /// <summary>
 /// RemotingClient to consume our remoting component
 /// </summary>

 public class RemotingClient
 {
  private staticUseRemoting UseRemoting myRemoteObject;
  public static bool Start()
  {
   ChannelServices.RegisterChannel(new HttpChannel());
   RemotingConfiguration.RegisterWellKnownClientType(
    typeof(UseRemoting),"http://localhost:1001/DoAll");
   myRemoteObject=new UseRemoting();
   myRemoteObject.LogUserRequest("MSMITH","I need to borrow a Laptop ASAP");
   return true;
  }
 }
}

You last visited
Web Objects
Inheritance C# .net
XML
Assemblies
DDL Sql Server
Sql Server Basic functions
COM +
DML Sql Server
 
 
Make a secure donation now with PayPal!