Exemple #1
0
 protected override void OnStart(string[] args)
 {
     try
     {
         serviceHost = new Service.ServiceMonitor();
         try
         {
             if (serviceHost != null)
             {
                 serviceHost.Start();
                 SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”已启动", serviceHost.ToString()));
             }
             else
             {
                 SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”启动失败,服务初始化失败", serviceHost.ToString()));
             }
         }
         catch (Exception ex)
         {
             SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”启动遇到异常:{1}", serviceHost.ToString(), ex.Message));
         }
     }
     catch (Exception ex)
     {
         SeatManage.SeatManageComm.WriteLog.Write(string.Format("ServiceHost启动遇到异常:{0}", ex.Message));
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            var binding        = new BasicHttpBinding();
            var endpoint       = new EndpointAddress("http://localhost:8080/FirstService");
            var channelFactory = new ChannelFactory <IService.IService>(binding, endpoint);

            IService.IService client = null;

            try
            {
                client = channelFactory.CreateChannel();
                Console.WriteLine("Enter a year");

                do
                {
                    long   year     = long.Parse(Console.ReadLine());
                    string response = client.ChampWinner(year);
                    Console.WriteLine(response);
                }while (true);

                ((ICommunicationObject)client).Close();
            }
            catch
            {
                if (client != null)
                {
                    ((ICommunicationObject)client).Abort();
                }
            }
            Console.ReadKey();
        }
 protected override void OnStart(string[] args)
 {
     try
     {
         serviceHost = new Service.FileService();
         try
         {
             serviceHost.Start(); SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”已启动", serviceHost.ToString()));
         }
         catch (Exception ex)
         {
             SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”启动遇到异常:{1}", serviceHost.ToString(), ex.Message));
         }
     }
     catch (Exception ex)
     {
         SeatManage.SeatManageComm.WriteLog.Write(string.Format("ServiceHost启动遇到异常:{0}", ex.Message));
     }
 }
 public HomeController(IService.IService <JHW.Models.EntityModels.Users> service)
 {
     _service = service;
 }
Exemple #5
0
 public HomeController(IService.IService <Models.User> userService, IService.IService <Models.Book> bookService)
 {
     _userService = userService;
     _bookService = bookService;
 }