aspnet / MetaPackages

[Archived] NuGet meta packages. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
211 stars 109 forks source link

CreateDefaultBuilder doesn't work with command line "dotnet run -urls http://xxxx:xxxx" #226

Closed wjf108 closed 7 years ago

wjf108 commented 7 years ago

WebHost.cs line:173

public static IWebHostBuilder CreateDefaultBuilder(string[] args)
{
    ....
    if (args != null)
    {
        config.AddCommandLine(args);
    }
    ....
}

It doesn't work with "dotnet run -urls http://xxxx:xxxx", unless I add the following code manually:

public static void Main(string[] args)
        {
            var commandConfig = new ConfigurationBuilder()
                .AddCommandLine(args)
                .Build();
            WebHost.CreateDefaultBuilder(args)
                .UseConfiguration(commandConfig)
                .UseStartup<Startup>()
                .Build()
                .Run();
        }
Tratcher commented 7 years ago

Duplicate of https://github.com/aspnet/MetaPackages/issues/221