⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 应用框架的设计与实现的源代码(SAF) 《应用框架的设计与实现》随书源码
💻 CS
字号:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Http;
using System.Runtime.Remoting.Channels;
using SAF.EventNotification;
using SAF.Configuration;
using System.Configuration;
using System.Collections;
using System.Runtime.Serialization.Formatters;

namespace TestConsole
{
	/// <summary>
	/// This console application show how to install EventNotification service on the event server.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		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();


		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -