static void Main(string[] args) { ConfigurationManager cm = (ConfigurationManager)ConfigurationSettings.GetConfig("GreenFram"); EventNotificationConfiguration enc = cm.EventNotificationConfig; //建立网络渠道接受的事件客户端的请求 IDictionary props = new Hashtable(); props["port"] = Int32.Parse(enc.GetPortNumber()); BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider(); provider.TypeFilterLevel = TypeFilterLevel.Full; HttpChannel channel = new HttpChannel(props, null, provider); ChannelServices.RegisterChannel(channel); //注册remote对象类型 WellKnownServiceTypeEntry wste = new WellKnownServiceTypeEntry(typeof(EventServer), enc.GetObjectUri(), WellKnownObjectMode.Singleton); RemotingConfiguration.ApplicationName = enc.GetApplicationName(); RemotingConfiguration.RegisterWellKnownServiceType(wste); Console.WriteLine("事件通知服务运行中..."); Console.WriteLine("Press Enter to exit"); Console.ReadLine(); }
static void Main(string[] args) { ConfigurationManager cm = (ConfigurationManager)ConfigurationSettings.GetConfig("Framework"); EventNotificationConfiguration enc = cm.EventNotificationConfig; //set up the network channel for accepting calls from event clients and making calls //to the event clients. HttpChannel channel = new HttpChannel(Int32.Parse(enc.GetPortNumber())); ChannelServices.RegisterChannel(channel); //register the remote object type. WellKnownServiceTypeEntry wste = new WellKnownServiceTypeEntry(typeof(EventServer), enc.GetObjectUri(), WellKnownObjectMode.Singleton); RemotingConfiguration.ApplicationName = enc.GetApplicationName(); RemotingConfiguration.RegisterWellKnownServiceType(wste); Console.WriteLine("Press Enter to exit"); Console.ReadLine(); }
static void Main(string[] args) { ConfigurationManager cm = (ConfigurationManager)ConfigurationSettings.GetConfig("Framework"); EventNotificationConfiguration enc = cm.EventNotificationConfig; //set up the network channel for accepting calls from event clients and making calls //to the event clients. IDictionary props = new Hashtable(); props["port"] = Int32.Parse(enc.GetPortNumber()); BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider(); provider.TypeFilterLevel = TypeFilterLevel.Full; HttpChannel channel = new HttpChannel(props, null, provider); ChannelServices.RegisterChannel(channel); //register the remote object type. WellKnownServiceTypeEntry wste = new WellKnownServiceTypeEntry(typeof(EventServer), enc.GetObjectUri(), WellKnownObjectMode.Singleton); RemotingConfiguration.ApplicationName = enc.GetApplicationName(); RemotingConfiguration.RegisterWellKnownServiceType(wste); Console.WriteLine("Press Enter to exit"); Console.ReadLine(); }