// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(); services.AddSignalR(); services.Configure <RazorViewEngineOptions>(o => { o.ViewLocationExpanders.Add(new MyViewLocationExpander()); }); services.AddMvc() .AddJsonOptions(options => { options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; options.SerializerSettings.Converters.Add(new StringEnumConverter { CamelCaseText = true }); }); var connections = Configuration.GetSection("ConnectionStrings"); services.AddDbContext <DataContext>(options => options.UseSqlServer(connections["DefaultConnection"])); // IoC ServicesModule.AddServices(services); var serviceProvider = services.BuildServiceProvider(); services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(options => { Configuration.GetSection("Auth0").Bind(options); options.Events = GetJwtBearerEvents(serviceProvider); }); Console.WriteLine("Env: " + HostingEnvironment.EnvironmentName); if (!HostingEnvironment.IsDevelopment() && !HostingEnvironment.IsEnvironment("local")) { // services.Configure<MvcOptions>(options => { // options.Filters.Add(new RequireHttpsAttribute()); // }); } }