public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseResponseCompression(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(routes => { routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}"); }); CosmosDBRepository <Book> .Initialize(); app.UseBlazor <Client.Program>(); }
// 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) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddApplicationError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); //app.UseHsts(); } env.ConfigureNLog("nlog.config"); //add NLog to ASP.NET Core loggerFactory.AddNLog(); loggerFactory.AddProvider(new NLogLoggerProvider()); app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); // app.UseCors(options => options.WithOrigins("http://localhost:4200").AllowAnyMethod()); //app.UseHttpsRedirection(); app.UseAuthentication(); app.UseMvc(); CosmosDBRepository <User> .Initialize(); }