Example #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, ISeederManager seederManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler(builder =>
                {
                    builder.Run(async context =>
                    {
                        context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                        var hata = context.Features.Get <IExceptionHandlerFeature>();
                        if (hata != null)
                        {
                            context.Response.UygulamaHatasiEkle();
                            await context.Response.WriteAsync(hata.Error.Message);
                        }
                    });
                });
            }


            app.UseCors(c => c.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials());;
            app.UseAuthentication();
            app.UseMvc();
        }
Example #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, ISeederManager seederManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler(builder =>
                {
                    builder.Run(async context =>
                    {
                        context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;

                        var hata = context.Features.Get <IExceptionHandlerFeature>();
                        if (hata != null)
                        {
                            context.Response.UygulamaHatasiEkle(hata.Error.Message);
                            await context.Response.WriteAsync(hata.Error.Message);
                        }
                    });
                });
            }

            app.UseCors(c => c.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials());
            app.UseAuthentication();
            app.UseDefaultFiles();
            app.UseStaticFiles();
            app.UseMvc(routes =>
            {
                routes.MapSpaFallbackRoute(name: "spa-fallback", defaults: new { controller = "AnaSayfa", action = "giris" });
            });
        }