private static void LoadWatchDog()
 {
     try
     {
         WatchDogHandler.StarWatchDog();
     }
     catch (Exception ex)
     {
         Console.WriteLine("\nError Loading WatchDog. ");
         Console.WriteLine("Exception : " + ex.Message);
         throw;
     }
 }
Exemple #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            app.UseSignalR(routes =>
            {
                routes.MapHub <WatchDogHub>("/watchDogHub");
            });

            _hubContext = app.ApplicationServices.GetService <IHubContext <WatchDogHub, IWatchDog> >();

            WatchDogHandler watchDogHandler = new WatchDogHandler(_hubContext);
            WatchDogChecks  watchDogChecks  = new WatchDogChecks(_hubContext);

            watchDogTests.Add(() => watchDogChecks.CheckOldFilesFromDirectory(@"C:\OppariUnitTests", ".txt"));
            watchDogTests.Add(() => watchDogChecks.CheckSqlQueries("SELECT * FROM dbo.WatchDogErrors"));

            //"Cherkers.EkaChecker", "arg1;arg2"
            //Chekers.ViisasCheker

            //foreach(var tietokantarivi in rivit)
            //    var instanssi = IOC.XXX(tietokantarivi.nimi, args)
            //    watchdogtests.add(instanssi)
            //    )

            //watchDogTests.Add(new Check1(new string[] { "aa" }));
            //watchDogTests.Add(new Check2(new string[] { "aa" }));
        }