Server.cs
Upload User: yiyuerguo
Upload Date: 2014-09-27
Package Size: 3781k
Code Size: 1k
Category:

CSharp

Development Platform:

Others

  1. using System;
  2. using System.Runtime.Remoting;
  3. using System.Runtime.Remoting.Channels;
  4. using System.Runtime.Remoting.Channels.Http;
  5. namespace MathServer
  6. {
  7.    class ServerMain
  8.    {
  9.       static void Main(string[] args)
  10.       {
  11.          // Create a channel specifying the port #
  12.          HttpChannel channel = new HttpChannel(13101);
  13.          // Register the channel with the runtime remoting services
  14.          ChannelServices.RegisterChannel(channel);
  15.          // Register a type as a well known type
  16.          RemotingConfiguration.RegisterWellKnownServiceType(
  17.             typeof(MathLibrary.SimpleMath), // The type to register
  18.             "MyURI.soap",                   // The well known name
  19.             WellKnownObjectMode.Singleton   // SingleCall or Singleton
  20.             );
  21.          // Keep the server alive until enter is pressed.
  22.          Console.WriteLine("Server started. Press Enter to end");
  23.          Console.ReadLine();
  24.       }
  25.    }
  26. }