1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.ServiceModel;
- using System.ServiceModel.Description;
- using System.Text;
- using System.Threading.Tasks;
- using log4net;
- namespace GDNXFD.WcfHost
- {
- class Program
- {
- static void Main(string[] args)
- {
- ILog logger = LogManager.GetLogger("AppLog");
- try
- {
- logger.Info("日志写入测试");
- //以配置文件方式配置终结点
- ServiceHost host = new ServiceHost(typeof(GDNXFD.WcfService.AlertService));
- host.Open();
- ServiceHost host2 = new ServiceHost(typeof(GDNXFD.WcfService.AdviceService));
- host2.Open();
- ServiceHost host3 = new ServiceHost(typeof(GDNXFD.WcfService.DefectBillService));
- host3.Open();
- ServiceHost host4 = new ServiceHost(typeof(GDNXFD.WcfService.FaultInfoService));
- host4.Open();
- }
- catch (Exception ex)
- {
- Console.WriteLine("创建ServiceHost出现异常");
- logger.Info(ex.Message);
- }
- Console.WriteLine("WCF服务启动成功......");
- //int i = 0;
- //foreach (ServiceEndpoint endpoint in host.Description.Endpoints)
- //{
- // i++;
- // Console.WriteLine("终结点序号:{0},终结点名称:{1},终结点地址:{2},终结点绑定:{3}{4}", i, endpoint.Name, endpoint.Address, endpoint.Binding, Environment.NewLine);
- //}
- try
- {
- Console.WriteLine("线程启动......");
- GDNXFD.WcfService.AdviceWorker.Instance.Start();
- }
- catch (Exception ex)
- {
- //logger.Info(ex.Message);
- }
- while (true)
- {
- Console.Read();
- }
- }
- }
- }
|