Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IHomegearConnectionService homegear)
        {
            loggerFactory.AddConsole();
            loggerFactory.AddNLog();

            this.logger.LogDebug("Confguration of the request pipeline.");

            if (env.IsDevelopment())
            {
                this.logger.LogDebug("Development environment detected");
                this.logger.LogDebug("Adding the developer exception.");
                app.UseDeveloperExceptionPage();
            }

            app.AddNLogWeb();
            app.UseStaticFiles();
            app.UseStatusCodePages();

            if (env.IsDevelopment())
            {
                this.logger.LogDebug("Adding CORS.");
                // Add cors for the Aurelia client, which is developed as a separate project and runs on a separate port
                app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
            }

            app.UseMvcWithDefaultRoute();

            env.ConfigureNLog("nlog.config");
        }
Esempio n. 2
0
 public StatusController(IHomegearConnectionService homegearService)
 {
     this._homegearService = homegearService;
 }