{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Hosting/issues/1491","repository_url":"https://api.github.com/repos/aspnet/Hosting","labels_url":"https://api.github.com/repos/aspnet/Hosting/issues/1491/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Hosting/issues/1491/comments","events_url":"https://api.github.com/repos/aspnet/Hosting/issues/1491/events","html_url":"https://github.com/aspnet/Hosting/issues/1491","id":341316826,"node_id":"MDU6SXNzdWUzNDEzMTY4MjY=","number":1491,"title":"IServerAddressesFeature doesn't work correctly","user":{"login":"0Lucifer0","id":15112753,"node_id":"MDQ6VXNlcjE1MTEyNzUz","avatar_url":"https://avatars0.githubusercontent.com/u/15112753?v=4","gravatar_id":"","url":"https://api.github.com/users/0Lucifer0","html_url":"https://github.com/0Lucifer0","followers_url":"https://api.github.com/users/0Lucifer0/followers","following_url":"https://api.github.com/users/0Lucifer0/following{/other_user}","gists_url":"https://api.github.com/users/0Lucifer0/gists{/gist_id}","starred_url":"https://api.github.com/users/0Lucifer0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0Lucifer0/subscriptions","organizations_url":"https://api.github.com/users/0Lucifer0/orgs","repos_url":"https://api.github.com/users/0Lucifer0/repos","events_url":"https://api.github.com/users/0Lucifer0/events{/privacy}","received_events_url":"https://api.github.com/users/0Lucifer0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-15T12:20:28Z","updated_at":"2018-07-15T21:32:02Z","closed_at":null,"author_association":"NONE","body":"Hello, it seems the ServerFeatures.Set<T> doesn't work correctly.\r\nthis is a code  sample to test this issue\r\n```\r\n using Microsoft.AspNetCore;\r\nusing Microsoft.AspNetCore.Builder;\r\nusing Microsoft.AspNetCore.Hosting;\r\nusing Microsoft.AspNetCore.Hosting.Server.Features;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing Microsoft.Extensions.Logging;\r\n\r\nnamespace BugTest\r\n{\r\n    class BugTest\r\n    {\r\n\t    public static void MainBug()\r\n\t    {\r\n\t\t    var host = BuildWebHost(null);\r\n\t\t    host.ServerFeatures.Set<IServerAddressesFeature>(new ServerAddressesFeature { Addresses = { \"http://+:1337\" }, PreferHostingUrls = true });\r\n\t\t    host.Run(); // Doesn't work - logger say it use port 1337 but netstat show port 5000\r\n        }\r\n\r\n        public static void Main()\r\n        {\r\n            var host = BuildWebHost(null);\r\n            var serveraddress = host.ServerFeatures[typeof(ServerAddressesFeature)] as ServerAddressesFeature;\r\n            serveraddress.Addresses.Add(\"http://+:1337\");\r\n            serveraddress.PreferHostingUrls = true;\r\n            host.Run(); //work - logger say it use port 1337 and netstat show port 1337\r\n        }\r\n\r\n        private static IWebHost BuildWebHost(string[] args)\r\n        {\r\n            return WebHost.CreateDefaultBuilder(args)\r\n                .UseStartup<Startup>()\r\n                .Build();\r\n        }\r\n    }\r\n\r\n    public class Startup\r\n    {\r\n        // Use this method to add services to the container.\r\n        public void ConfigureServices(IServiceCollection services)\r\n        {\r\n        }\r\n\r\n        // Use this method to configure the HTTP request pipeline.\r\n        public void Configure(IApplicationBuilder app)\r\n        {\r\n\r\n        }\r\n    }\r\n}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/aspnet/Hosting/issues/comments/405119930","html_url":"https://github.com/aspnet/Hosting/issues/1491#issuecomment-405119930","issue_url":"https://api.github.com/repos/aspnet/Hosting/issues/1491","id":405119930,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTExOTkzMA==","user":{"login":"0Lucifer0","id":15112753,"node_id":"MDQ6VXNlcjE1MTEyNzUz","avatar_url":"https://avatars0.githubusercontent.com/u/15112753?v=4","gravatar_id":"","url":"https://api.github.com/users/0Lucifer0","html_url":"https://github.com/0Lucifer0","followers_url":"https://api.github.com/users/0Lucifer0/followers","following_url":"https://api.github.com/users/0Lucifer0/following{/other_user}","gists_url":"https://api.github.com/users/0Lucifer0/gists{/gist_id}","starred_url":"https://api.github.com/users/0Lucifer0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0Lucifer0/subscriptions","organizations_url":"https://api.github.com/users/0Lucifer0/orgs","repos_url":"https://api.github.com/users/0Lucifer0/repos","events_url":"https://api.github.com/users/0Lucifer0/events{/privacy}","received_events_url":"https://api.github.com/users/0Lucifer0/received_events","type":"User","site_admin":false},"created_at":"2018-07-15T21:32:02Z","updated_at":"2018-07-15T21:32:02Z","author_association":"NONE","body":"Not really a specific reason and the 2nd solution (main) work great. But still seems like a bug because the logger use the new one so the logger say listening on port 1337 even if port is 5000. My initial goal was to try to change the port in the startup and not in the UseUrls"}}
{"actor":{"display_login":"0Lucifer0"}}