3.1 merge

This commit is contained in:
Tommy Parnell
2020-08-01 18:47:09 -04:00
parent 71cf945baf
commit da8a0d9a4f
3 changed files with 10 additions and 17 deletions

View File

@@ -19,7 +19,6 @@ namespace TerribleDev.Blog.Web
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseApplicationInsights()
.UseStartup<Startup>()
.ConfigureKestrel(a =>
{

View File

@@ -1,22 +1,17 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.Net.Http.Headers;
using HardHat;
using TerribleDev.Blog.Web.Models;
using TerribleDev.Blog.Web.Factories;
using Microsoft.Extensions.Hosting;
namespace TerribleDev.Blog.Web
{
@@ -47,19 +42,15 @@ namespace TerribleDev.Blog.Web
var posts = new BlogFactory().GetAllPosts(Env.IsDevelopment() ? "https://localhost:5001": "https://blog.terrible.dev");
return BlogCacheFactory.ProjectPostCache(posts);
});
services.AddApplicationInsightsTelemetry();
services.AddControllersWithViews();
services.AddResponseCompression(a =>
{
a.EnableForHttps = true;
})
.AddMemoryCache()
.AddMvcCore(a => {
a.EnableEndpointRouting = false;
})
.AddCacheTagHelper()
.AddRazorViewEngine()
.SetCompatibilityVersion(CompatibilityVersion.Latest);
services.AddOutputCaching();
.AddOutputCaching();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -77,7 +68,6 @@ namespace TerribleDev.Blog.Web
app.UseHttpsRedirection();
app.UseResponseCompression();
var cacheTime = env.IsDevelopment() ? 0 : 31536000;
app.UseStaticFiles(new StaticFileOptions
{
@@ -119,7 +109,11 @@ namespace TerribleDev.Blog.Web
UpgradeInsecureRequests = true
});
app.UseOutputCaching();
app.UseMvc();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

View File

@@ -23,7 +23,7 @@
<ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />
<PackageReference Include="Markdig" Version="0.15.7" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" />
<PackageReference Include="UriBuilder.Fluent" Version="1.5.2" />