Example #1
0
        protected override void OnStart(string[] args)
        {
            SmsControllerServiceType controlType = new SmsControllerServiceType();

            controlType.BeforeHostStart();

            try
            {
                _SmsServiceTypeHost = new ServiceHost(typeof(SmsServerServiceType));
                _SmsServiceTypeHost.Open();

                _SmsControllerServiceTypeHost = new ServiceHost(typeof(SmsControllerServiceType));
                _SmsControllerServiceTypeHost.Open();
            }
            catch (Exception e)
            {
                GetLogInstance.GetInstance.DoWriteEventLog(string.Format("开启整个短信服务失败,原因是:{0}", e.Message), EventType.Error);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                SmsControllerServiceType controlType = new SmsControllerServiceType();
                controlType.BeforeHostStart();

                ServiceHost _SmsServiceTypeHost = new ServiceHost(typeof(SmsServerServiceType));
                _SmsServiceTypeHost.Open();

                ServiceHost _SmsControllerServiceType = new ServiceHost(typeof(SmsControllerServiceType));
                _SmsControllerServiceType.Open();

                Console.ReadKey(true);

                _SmsServiceTypeHost.Close();
                _SmsControllerServiceType.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }