public static IMvcBuilder AddMvcWithHttps(this IServiceCollection services, HttpsMvcOptions httpsOptions = null) { if (httpsOptions == null) { httpsOptions = HttpsMvcOptions.Create(); } services.AddAntiforgery( options => { options.UseHttps(); } ); return(services.AddMvc( options => { httpsOptions.Apply(options); options.UseHttps(); } )); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddIdentityClientWithDefaults(); services.AddMvcWithHttps(HttpsMvcOptions.Create(4430)); }