#331 Add IServerAddressesFeature.
This commit is contained in:
parent
896c146e24
commit
bda0386a93
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,6 +12,7 @@ using Microsoft.AspNet.Hosting.Startup;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Features;
|
using Microsoft.AspNet.Http.Features;
|
||||||
using Microsoft.AspNet.Http.Features.Internal;
|
using Microsoft.AspNet.Http.Features.Internal;
|
||||||
|
using Microsoft.AspNet.Server.Features;
|
||||||
using Microsoft.Framework.Configuration;
|
using Microsoft.Framework.Configuration;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Logging;
|
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();
|
_applicationLifetime.NotifyStarted();
|
||||||
|
|
||||||
return new Disposable(() =>
|
return new Disposable(() =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue