From 2c72d586ed5e515fb1f71f4bb216d231314aa7f1 Mon Sep 17 00:00:00 2001 From: Bart Calixto Date: Fri, 16 Oct 2015 00:47:26 -0300 Subject: [PATCH] Update the Mvc.Client/Mvc.Server samples to use HttpPlatformHandler --- .../Mvc.Client/Properties/launchSettings.json | 25 +++++++++++++ samples/Mvc.Client/Startup.cs | 9 +++-- samples/Mvc.Client/project.json | 35 ++++++++++--------- samples/Mvc.Client/wwwroot/web.config | 9 +++++ .../Mvc.Server/Properties/launchSettings.json | 25 +++++++++++++ samples/Mvc.Server/Startup.cs | 4 +++ samples/Mvc.Server/project.json | 9 ++--- samples/Mvc.Server/wwwroot/web.config | 8 ++--- 8 files changed, 93 insertions(+), 31 deletions(-) create mode 100644 samples/Mvc.Client/Properties/launchSettings.json create mode 100644 samples/Mvc.Client/wwwroot/web.config create mode 100644 samples/Mvc.Server/Properties/launchSettings.json diff --git a/samples/Mvc.Client/Properties/launchSettings.json b/samples/Mvc.Client/Properties/launchSettings.json new file mode 100644 index 00000000..b5a45a9e --- /dev/null +++ b/samples/Mvc.Client/Properties/launchSettings.json @@ -0,0 +1,25 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53507", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNET_ENVIRONMENT": "Development" + } + }, + "web": { + "commandName": "web", + "environmentVariables": { + "Hosting:Environment": "Development" + } + } + } +} \ No newline at end of file diff --git a/samples/Mvc.Client/Startup.cs b/samples/Mvc.Client/Startup.cs index b4fc30ef..e9be9720 100644 --- a/samples/Mvc.Client/Startup.cs +++ b/samples/Mvc.Client/Startup.cs @@ -20,7 +20,13 @@ namespace Mvc.Client { public void Configure(IApplicationBuilder app) { var factory = app.ApplicationServices.GetRequiredService(); factory.AddConsole(); - + + app.UseIISPlatformHandler(options => { + options.FlowWindowsAuthentication = false; + }); + + app.UseStaticFiles(); + // Insert a new cookies middleware in the pipeline to store the user // identity after he has been redirected from the identity provider. app.UseCookieAuthentication(options => { @@ -54,7 +60,6 @@ namespace Mvc.Client { options.Scope.Add("email"); }); - app.UseStaticFiles(); app.UseMvc(); } diff --git a/samples/Mvc.Client/project.json b/samples/Mvc.Client/project.json index a5d6732a..eecd16cb 100644 --- a/samples/Mvc.Client/project.json +++ b/samples/Mvc.Client/project.json @@ -1,13 +1,11 @@ { "webroot": "wwwroot", - "exclude": "wwwroot/**/*", - - "version": "1.0.0-*", "dependencies": { "Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*", "Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-*", + "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*", @@ -18,22 +16,25 @@ }, "commands": { - "kestrel": "Microsoft.AspNet.Hosting --server=Microsoft.AspNet.Server.Kestrel --server.urls=http://localhost:53507", - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:53507" + "web": "Microsoft.AspNet.Server.Kestrel" }, "frameworks": { - "dnx451": { - "frameworkAssemblies": { - "System.Net.Http": "4.0.0.0" - } - }, + "dnx451": { }, + "dnxcore50": { } + }, + + "exclude": [ + "wwwroot", + "node_modules", + "bower_components" + ], - "dnxcore50": { - "dependencies": { - "System.Net.Http": "4.0.1-*", - "System.Runtime.Serialization.Primitives": "4.0.11-*" - } - } - } + "publishExclude": [ + "node_modules", + "bower_components", + "**.xproj", + "**.user", + "**.vspscc" + ] } \ No newline at end of file diff --git a/samples/Mvc.Client/wwwroot/web.config b/samples/Mvc.Client/wwwroot/web.config new file mode 100644 index 00000000..c47e2a48 --- /dev/null +++ b/samples/Mvc.Client/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/samples/Mvc.Server/Properties/launchSettings.json b/samples/Mvc.Server/Properties/launchSettings.json new file mode 100644 index 00000000..8e76a57e --- /dev/null +++ b/samples/Mvc.Server/Properties/launchSettings.json @@ -0,0 +1,25 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:54540", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNET_ENVIRONMENT": "Development" + } + }, + "web": { + "commandName": "web", + "environmentVariables": { + "Hosting:Environment": "Development" + } + } + } +} \ No newline at end of file diff --git a/samples/Mvc.Server/Startup.cs b/samples/Mvc.Server/Startup.cs index d4fbae36..b2bf6040 100644 --- a/samples/Mvc.Server/Startup.cs +++ b/samples/Mvc.Server/Startup.cs @@ -39,6 +39,10 @@ namespace Mvc.Server { var factory = app.ApplicationServices.GetRequiredService(); factory.AddConsole(); + app.UseIISPlatformHandler(options => { + options.FlowWindowsAuthentication = false; + }); + app.UseStaticFiles(); // Add a middleware used to validate access diff --git a/samples/Mvc.Server/project.json b/samples/Mvc.Server/project.json index f76a517d..a72f265f 100644 --- a/samples/Mvc.Server/project.json +++ b/samples/Mvc.Server/project.json @@ -1,28 +1,23 @@ { "webroot": "wwwroot", - "version": "1.0.0-*", - "dependencies": { "Microsoft.AspNet.Authentication.Google": "1.0.0-*", "Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-*", "Microsoft.AspNet.Authentication.Twitter": "1.0.0-*", "Microsoft.AspNet.Diagnostics": "1.0.0-*", + "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*", - "EntityFramework.MicrosoftSqlServer": "7.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*", "OpenIddict": "1.0.0-*" }, "commands": { - "kestrel": "Microsoft.AspNet.Hosting --server=Microsoft.AspNet.Server.Kestrel --server.urls=http://localhost:54540", - "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:54540" + "web": "Microsoft.AspNet.Server.Kestrel" }, "frameworks": { diff --git a/samples/Mvc.Server/wwwroot/web.config b/samples/Mvc.Server/wwwroot/web.config index 8e3f2a69..c47e2a48 100644 --- a/samples/Mvc.Server/wwwroot/web.config +++ b/samples/Mvc.Server/wwwroot/web.config @@ -2,10 +2,8 @@ - - - - + + - + \ No newline at end of file