日期:2014-05-17 浏览次数:20503 次
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Host Started!");
HttpChannel channel = new HttpChannel(20001);//定义个通道并指定端口
ChannelServices.RegisterChannel(channel, false);//服务端注册通道
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Message.Message), "Message", WellKnownObjectMode.Singleton);//服务端注册类型,并使用Singletong激活方式
Message.Message.OnSendMessage += new Message.Message.MessageHandler(Message_OnSendMessage);//订阅事件
Console.Read();
}
public static void Message_OnSendMessage(string msg) //
{
Console.WriteLine(msg);
}
}