Skip to content

Instantly share code, notes, and snippets.

@OzSimon
Created February 6, 2019 06:52
Show Gist options
  • Save OzSimon/5d6702eecfd5d5d326b381cfbd66f908 to your computer and use it in GitHub Desktop.
Save OzSimon/5d6702eecfd5d5d326b381cfbd66f908 to your computer and use it in GitHub Desktop.
Asp.Net Core Configure Services
public void ConfigureServices(IServiceCollection services) {
services.Configure<GzipCompressionProviderOptions>(x => x.Level = System.IO.Compression.CompressionLevel.Optimal);
services.Configure<RouteOptions>(x => { x.LowercaseUrls = true; x.AppendTrailingSlash = false; });
services.AddMemoryCache();
services.AddResponseCaching();
services.AddResponseCompression(x => { x.EnableForHttps = true; });
services.AddSingleton<IConfiguration>(Configuration);
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment