Update the samples and launchsettings (#264)

This commit is contained in:
Chris R 2016-10-05 15:32:19 -07:00 committed by GitHub
parent a8e92d6de7
commit 47fc36453b
4 changed files with 29 additions and 9 deletions

View File

@ -1,7 +1,7 @@
{
"profiles": {
"sample": {
"commandName": "sample",
"HelloWorld": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:8080"
}

View File

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

View File

@ -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<WebListenerOptions>(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<WebListener>().Settings.UrlPrefixes;
var addresses = ListenerSettings.UrlPrefixes;
addresses.Add("http://localhost:12346/pathBase/");
app.Use(async (context, next) =>

View File

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