diff --git a/samples/Mvc.Client/Program.cs b/samples/Mvc.Client/Program.cs new file mode 100644 index 00000000..fe8a48b2 --- /dev/null +++ b/samples/Mvc.Client/Program.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; + +namespace Mvc.Client { + public static class Program { + public static void Main(string[] args) { + var host = new WebHostBuilder() + .ConfigureLogging(options => options.AddConsole()) + .ConfigureLogging(options => options.AddDebug()) + .UseDefaultHostingConfiguration(args) + .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff --git a/samples/Mvc.Client/Startup.cs b/samples/Mvc.Client/Startup.cs index 0ef3d261..e1954a15 100644 --- a/samples/Mvc.Client/Startup.cs +++ b/samples/Mvc.Client/Startup.cs @@ -1,25 +1,12 @@ using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Protocols.OpenIdConnect; namespace Mvc.Client { public class Startup { - public static void Main(string[] args) { - var application = new WebHostBuilder() - .UseDefaultHostingConfiguration(args) - .UseIISPlatformHandlerUrl() - .UseServer("Microsoft.AspNetCore.Server.Kestrel") - .UseStartup() - .Build(); - - application.Run(); - } - public void ConfigureServices(IServiceCollection services) { services.AddAuthentication(options => { options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; @@ -29,10 +16,7 @@ namespace Mvc.Client { services.AddMvcDnx(); } - public void Configure(IApplicationBuilder app, ILoggerFactory factory) { - factory.AddConsole(); - factory.AddDebug(); - + public void Configure(IApplicationBuilder app) { app.UseIISPlatformHandler(); app.UseForwardedHeaders(new ForwardedHeadersOptions { diff --git a/samples/Mvc.Server/Program.cs b/samples/Mvc.Server/Program.cs new file mode 100644 index 00000000..ea8f1a85 --- /dev/null +++ b/samples/Mvc.Server/Program.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; + +namespace Mvc.Server { + public static class Program { + public static void Main(string[] args) { + var host = new WebHostBuilder() + .ConfigureLogging(options => options.AddConsole()) + .ConfigureLogging(options => options.AddDebug()) + .UseDefaultHostingConfiguration(args) + .UseIISPlatformHandlerUrl() + .UseServer("Microsoft.AspNetCore.Server.Kestrel") + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff --git a/samples/Mvc.Server/Startup.cs b/samples/Mvc.Server/Startup.cs index c12f0b84..5b6d999d 100644 --- a/samples/Mvc.Server/Startup.cs +++ b/samples/Mvc.Server/Startup.cs @@ -2,7 +2,6 @@ using System.Linq; using AspNet.Security.OAuth.GitHub; using CryptoHelper; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; @@ -10,7 +9,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Mvc.Server.Models; using Mvc.Server.Services; using NWebsec.Middleware; @@ -19,17 +17,6 @@ using OpenIddict.Models; namespace Mvc.Server { public class Startup { - public static void Main(string[] args) { - var application = new WebHostBuilder() - .UseDefaultHostingConfiguration(args) - .UseIISPlatformHandlerUrl() - .UseServer("Microsoft.AspNetCore.Server.Kestrel") - .UseStartup() - .Build(); - - application.Run(); - } - public void ConfigureServices(IServiceCollection services) { var configuration = new ConfigurationBuilder() .AddJsonFile("config.json") @@ -53,10 +40,7 @@ namespace Mvc.Server { services.AddTransient(); } - public void Configure(IApplicationBuilder app, ILoggerFactory factory) { - factory.AddConsole(); - factory.AddDebug(); - + public void Configure(IApplicationBuilder app) { app.UseIISPlatformHandler(); app.UseForwardedHeaders(new ForwardedHeadersOptions {