如何指定使用dotnet cli通过特定配置运行我的Web应用程序。
我知道可以使用hosting.json,但是我没有找到任何文档以及如何与dotnet cli联系。
最佳答案
看一下这个样本:https://github.com/aspnet/Security/blob/dev/samples/CookieSample/Program.cs#L11
调整了命令行:
public static void Main(string[] args)
{
var config = new ConfigurationBuilder().AddCommandLine(args).Build();
var host = new WebHostBuilder()
.UseKestrel()
.UseConfiguration(config)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
然后调用
dotnet run server.urls=http://localhost:5001/
关于asp.net-core - dotnet运行具有特定URL的网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37351310/