protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); UpdateSheduler.Start(); }
static Thread listenThread; // thread for listener protected override void OnStart(string[] args) { //start the scheduler receiving from the external server and saving in local database of weather on schedule UpdateSheduler sheduler = new UpdateSheduler(minutesInterval: 60, cities: Setting.Cities); sheduler.Start(); try { server = new ServerObject(); //create listener listenThread = new Thread(new ThreadStart(server.Listen)); listenThread.Start(); } catch (Exception ex) { server.Disconnect(); Console.WriteLine(ex.Message); } }