updated to ASP.NET Core 2.2

This commit is contained in:
jwatmore
2019-01-07 21:22:19 -08:00
parent d0cc8a970d
commit c662aaa146
7 changed files with 12 additions and 18 deletions

View File

@@ -2,16 +2,16 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using WebApi.Helpers;
using WebApi.Services;
using Microsoft.IdentityModel.Tokens;
using System.Text;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc;
namespace WebApi
{
public class Startup
public class Startup
{
public Startup(IConfiguration configuration)
{
@@ -24,7 +24,7 @@ namespace WebApi
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
services.AddMvc();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
// configure strongly typed settings objects
var appSettingsSection = Configuration.GetSection("AppSettings");
@@ -56,17 +56,13 @@ namespace WebApi
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
// global cors policy
app.UseCors(x => x
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
.AllowAnyHeader());
app.UseAuthentication();