Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseMiddleware <ExceptionMiddleware> ();

            app.UseStatusCodePagesWithReExecute("/errors/{0}");

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseStaticFiles();
            app.UseStaticFiles(new StaticFileOptions {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), "Content")
                    ), RequestPath = "/content"
            });
            app.UseCors("CorsPolicy");
            app.UseAuthentication();
            app.UseAuthorization();
            SwaggerServiceExtentions.UseSwaggerDocumentation(app);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapFallbackToController("Index", "Fallback");
            });
        }
Ejemplo n.º 2
0
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddAutoMapper(typeof(MapperProfile));
     services.AddControllers()
     .AddNewtonsoftJson(option =>
                        option.SerializerSettings.ReferenceLoopHandling =
                            Newtonsoft.Json.ReferenceLoopHandling.Ignore
                        );
     services.AddSingleton <IConnectionMultiplexer> (c =>
     {
         var config = ConfigurationOptions.Parse(_configuration.GetConnectionString("Redis"), true);
         return(ConnectionMultiplexer.Connect(config));
     });
     ServicesConfiguration.Configure(services);
     services.AddIdentityService(_configuration);
     SwaggerServiceExtentions.AddSwaggerDocumentation(services);
     services.AddCors(options =>
     {
         options.AddPolicy("CorsPolicy", policy =>
         {
             policy.AllowAnyHeader()
             .AllowAnyMethod()
             .WithOrigins("https://localhost:4200");
         });
     });
 }