From 47fc36453b35396bcde43ed573c30b21b51116b0 Mon Sep 17 00:00:00 2001 From: Chris R Date: Wed, 5 Oct 2016 15:32:19 -0700 Subject: [PATCH] Update the samples and launchsettings (#264) --- samples/HelloWorld/Properties/launchSettings.json | 4 ++-- .../HotAddSample/Properties/launchSettings.json | 10 +++++++--- samples/HotAddSample/Startup.cs | 14 +++++++++++++- .../SelfHostServer/Properties/launchSettings.json | 10 +++++++--- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/samples/HelloWorld/Properties/launchSettings.json b/samples/HelloWorld/Properties/launchSettings.json index 6161971048..f96a6f4415 100644 --- a/samples/HelloWorld/Properties/launchSettings.json +++ b/samples/HelloWorld/Properties/launchSettings.json @@ -1,7 +1,7 @@ { "profiles": { - "sample": { - "commandName": "sample", + "HelloWorld": { + "commandName": "Project", "launchBrowser": true, "launchUrl": "http://localhost:8080" } diff --git a/samples/HotAddSample/Properties/launchSettings.json b/samples/HotAddSample/Properties/launchSettings.json index 62f539fadd..5df19c1327 100644 --- a/samples/HotAddSample/Properties/launchSettings.json +++ b/samples/HotAddSample/Properties/launchSettings.json @@ -1,9 +1,13 @@ { "profiles": { - "web": { - "commandName": "web", + "HotAddSample": { + "commandName": "Project", "launchBrowser": true, - "launchUrl": "http://localhost:12345" + "launchUrl": "http://localhost:12345", + "environmentVariables": { + "ASPNETCORE_URLS": "http://localhost:12345", + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } \ No newline at end of file diff --git a/samples/HotAddSample/Startup.cs b/samples/HotAddSample/Startup.cs index 089b14d01d..a6cf016890 100644 --- a/samples/HotAddSample/Startup.cs +++ b/samples/HotAddSample/Startup.cs @@ -2,6 +2,8 @@ using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Server.WebListener; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Server; @@ -12,11 +14,21 @@ namespace HotAddSample // will be reset before the end of the request. public class Startup { + public void ConfigureServices(IServiceCollection services) + { + services.Configure(options => + { + ListenerSettings = options.ListenerSettings; + }); + } + + public WebListenerSettings ListenerSettings { get; set; } + public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory) { loggerfactory.AddConsole(LogLevel.Information); - var addresses = app.ServerFeatures.Get().Settings.UrlPrefixes; + var addresses = ListenerSettings.UrlPrefixes; addresses.Add("http://localhost:12346/pathBase/"); app.Use(async (context, next) => diff --git a/samples/SelfHostServer/Properties/launchSettings.json b/samples/SelfHostServer/Properties/launchSettings.json index bca9b1f442..f2eaeff38b 100644 --- a/samples/SelfHostServer/Properties/launchSettings.json +++ b/samples/SelfHostServer/Properties/launchSettings.json @@ -1,9 +1,13 @@ { "profiles": { - "web": { - "commandName": "web", + "SelfHostServer": { + "commandName": "Project", "launchBrowser": true, - "launchUrl": "http://localhost:8080" + "launchUrl": "http://localhost:8080/", + "environmentVariables": { + "ASPNETCORE_URLS": "http://localhost:8080/", + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } \ No newline at end of file