Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

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

Closed
wjf108 opened this issue Aug 28, 2017 · 1 comment

Comments

@wjf108
Copy link

wjf108 commented Aug 28, 2017

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
Copy link
Member

Duplicate of #221

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants