protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); ImageWebModel model = ImageWebModel.GetModel(); CommandsController cc = new CommandsController(model); ComunicationClient client = ComunicationClient.GetClient(8000); client.CommandReceived += delegate(object senderObj, CommandReceivedEventArgs args) { JsonCommand jCommand = args.JsonCommand; cc.ExecuteCommand(jCommand.CommandID, jCommand.Args, jCommand.JsonData); }; try { client.ConnectToServer(); client.sendCommand((int)CommandsEnum.GetConfigCommand, null); client.sendCommand((int)CommandsEnum.LogsCommand, null); } catch { Console.WriteLine("failed to connect to server"); } }