/// <summary> /// 应用程序的主入口点。 /// </summary> static void Main() { #if DEBUG HttpSelfHostConfiguration config = new HttpSelfHostConfiguration("http://localhost:9003"); config.Routes.MapHttpRoute("default", "business/{controller}/{action}/{id}", new { id = RouteParameter.Optional }); //config.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); ////默认返回 json //config.Formatters.JsonFormatter.MediaTypeMappings.Add( // new QueryStringMapping("datatype", "json", "application/json")); //初始化下级采集器,采集器运行即开始监听 MonitorItemBusiness.GetInstance().Init(); //开始对下级采集器进行轮询状态监测(先初始化,后开始监测) CollectorBusiness.GetInstance().StartCheckState(); using (var server = new HttpSelfHostServer(config)) { server.OpenAsync().Wait(); Application.Run(new Form1()); } #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service() }; ServiceBase.Run(ServicesToRun); #endif }
public bool Edit(MonitorItemDBModel model) { try { return(MonitorItemBusiness.GetInstance().EditMonitorItem(model)); } catch (Exception ex) { throw new HttpResponseException(new HttpResponseMessage() { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(ex.Message) }); } }