#331 Add IServerAddressesFeature.

This commit is contained in:
Chris R 2015-09-11 12:14:29 -07:00
parent 896c146e24
commit bda0386a93
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace Microsoft.AspNet.Server.Features
{
public interface IServerAddressesFeature
{
ICollection<string> Addresses { get; }
}
}

View File

@ -12,6 +12,7 @@ using Microsoft.AspNet.Hosting.Startup;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http.Features.Internal;
using Microsoft.AspNet.Server.Features;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
@ -95,6 +96,15 @@ namespace Microsoft.AspNet.Hosting.Internal
}
});
var serverAddresses = _serverInstance.Get<IServerAddressesFeature>();
if (serverAddresses != null)
{
foreach (var address in serverAddresses.Addresses)
{
logger.LogInformation("Now listening on: " + address);
}
}
_applicationLifetime.NotifyStarted();
return new Disposable(() =>