Server.cs
资源名称:Visual.rar [点击查看]
上传用户:yiyuerguo
上传日期:2014-09-27
资源大小:3781k
文件大小:1k
源码类别:
C#编程
开发平台:
Others
- using System;
- using System.Runtime.Remoting;
- using System.Runtime.Remoting.Channels;
- using System.Runtime.Remoting.Channels.Http;
- namespace MathServer
- {
- class ServerMain
- {
- static void Main(string[] args)
- {
- // Create a channel specifying the port #
- HttpChannel channel = new HttpChannel(13101);
- // Register the channel with the runtime remoting services
- ChannelServices.RegisterChannel(channel);
- // Register a type as a well known type
- RemotingConfiguration.RegisterWellKnownServiceType(
- typeof(MathLibrary.SimpleMath), // The type to register
- "MyURI.soap", // The well known name
- WellKnownObjectMode.Singleton // SingleCall or Singleton
- );
- // Keep the server alive until enter is pressed.
- Console.WriteLine("Server started. Press Enter to end");
- Console.ReadLine();
- }
- }
- }