Browse Source

Update the Mvc.Client/Mvc.Server samples to use HttpPlatformHandler

pull/34/head
Bart Calixto 10 years ago
committed by Kévin Chalet
parent
commit
2c72d586ed
  1. 25
      samples/Mvc.Client/Properties/launchSettings.json
  2. 9
      samples/Mvc.Client/Startup.cs
  3. 35
      samples/Mvc.Client/project.json
  4. 9
      samples/Mvc.Client/wwwroot/web.config
  5. 25
      samples/Mvc.Server/Properties/launchSettings.json
  6. 4
      samples/Mvc.Server/Startup.cs
  7. 9
      samples/Mvc.Server/project.json
  8. 8
      samples/Mvc.Server/wwwroot/web.config

25
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"
}
}
}
}

9
samples/Mvc.Client/Startup.cs

@ -20,7 +20,13 @@ namespace Mvc.Client {
public void Configure(IApplicationBuilder app) { public void Configure(IApplicationBuilder app) {
var factory = app.ApplicationServices.GetRequiredService<ILoggerFactory>(); var factory = app.ApplicationServices.GetRequiredService<ILoggerFactory>();
factory.AddConsole(); factory.AddConsole();
app.UseIISPlatformHandler(options => {
options.FlowWindowsAuthentication = false;
});
app.UseStaticFiles();
// Insert a new cookies middleware in the pipeline to store the user // Insert a new cookies middleware in the pipeline to store the user
// identity after he has been redirected from the identity provider. // identity after he has been redirected from the identity provider.
app.UseCookieAuthentication(options => { app.UseCookieAuthentication(options => {
@ -54,7 +60,6 @@ namespace Mvc.Client {
options.Scope.Add("email"); options.Scope.Add("email");
}); });
app.UseStaticFiles();
app.UseMvc(); app.UseMvc();
} }

35
samples/Mvc.Client/project.json

@ -1,13 +1,11 @@
{ {
"webroot": "wwwroot", "webroot": "wwwroot",
"exclude": "wwwroot/**/*",
"version": "1.0.0-*",
"dependencies": { "dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Mvc": "6.0.0-*",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-*", "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*",
"Microsoft.AspNet.Authentication.OpenIdConnect": "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.Kestrel": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.StaticFiles": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*",
@ -18,22 +16,25 @@
}, },
"commands": { "commands": {
"kestrel": "Microsoft.AspNet.Hosting --server=Microsoft.AspNet.Server.Kestrel --server.urls=http://localhost:53507", "web": "Microsoft.AspNet.Server.Kestrel"
"web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:53507"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnx451": { },
"frameworkAssemblies": { "dnxcore50": { }
"System.Net.Http": "4.0.0.0" },
}
}, "exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"dnxcore50": { "publishExclude": [
"dependencies": { "node_modules",
"System.Net.Http": "4.0.1-*", "bower_components",
"System.Runtime.Serialization.Primitives": "4.0.11-*" "**.xproj",
} "**.user",
} "**.vspscc"
} ]
} }

9
samples/Mvc.Client/wwwroot/web.config

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer>
</configuration>

25
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"
}
}
}
}

4
samples/Mvc.Server/Startup.cs

@ -39,6 +39,10 @@ namespace Mvc.Server {
var factory = app.ApplicationServices.GetRequiredService<ILoggerFactory>(); var factory = app.ApplicationServices.GetRequiredService<ILoggerFactory>();
factory.AddConsole(); factory.AddConsole();
app.UseIISPlatformHandler(options => {
options.FlowWindowsAuthentication = false;
});
app.UseStaticFiles(); app.UseStaticFiles();
// Add a middleware used to validate access // Add a middleware used to validate access

9
samples/Mvc.Server/project.json

@ -1,28 +1,23 @@
{ {
"webroot": "wwwroot", "webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": { "dependencies": {
"Microsoft.AspNet.Authentication.Google": "1.0.0-*", "Microsoft.AspNet.Authentication.Google": "1.0.0-*",
"Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-*", "Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-*",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-*", "Microsoft.AspNet.Authentication.Twitter": "1.0.0-*",
"Microsoft.AspNet.Diagnostics": "1.0.0-*", "Microsoft.AspNet.Diagnostics": "1.0.0-*",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-*",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*", "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.StaticFiles": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*",
"EntityFramework.MicrosoftSqlServer": "7.0.0-*",
"Microsoft.Extensions.Logging.Console": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*",
"OpenIddict": "1.0.0-*" "OpenIddict": "1.0.0-*"
}, },
"commands": { "commands": {
"kestrel": "Microsoft.AspNet.Hosting --server=Microsoft.AspNet.Server.Kestrel --server.urls=http://localhost:54540", "web": "Microsoft.AspNet.Server.Kestrel"
"web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:54540"
}, },
"frameworks": { "frameworks": {

8
samples/Mvc.Server/wwwroot/web.config

@ -2,10 +2,8 @@
<configuration> <configuration>
<system.webServer> <system.webServer>
<handlers> <handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers> </handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer> </system.webServer>
</configuration> </configuration>
Loading…
Cancel
Save