示例#1
0
文件: Program.cs 项目: rynnwang/gicon
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            #if DEBUG
            List<string> uriList = new List<string>();

            foreach (var one in Settings.Default.UriPrefix)
            {
                uriList.Add(one);
            }

            var httpServer = new GuidIconHttpService(uriList.ToArray());
            httpServer.Start();

            Console.WriteLine("CoreCloudService has been launched.");

            while (true)
            {
                Console.WriteLine(string.Format("{0} Working...", DateTime.Now.ToString()));
                Thread.Sleep(1000);
            }
            #else
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new GuidIconHttpServiceHost()
            };
            ServiceBase.Run(ServicesToRun);

            #endif
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GuidIconHttpServiceHost"/> class.
        /// </summary>
        public GuidIconHttpServiceHost()
            : base()
        {
            InitializeComponent();

            if (httpServer == null)
            {
                lock (locker)
                {
                    if (httpServer == null)
                    {
                        List<string> uriList = new List<string>();

                        foreach (var one in Settings.Default.UriPrefix)
                        {
                            uriList.Add(one);
                        }

                        httpServer = new GuidIconHttpService(uriList.ToArray());
                    }
                }
            }
        }