本文介绍了dotnet运行具有特定URL的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何指定使用dotnet cli通过特定配置运行我的Web应用程序.我知道可以使用hosting.json,但是我没有找到任何文档以及如何与dotnet cli联系起来.
How can I specify using dotnet cli to run my web app using specific configurations.I know hosting.json can be used but I did not find any documentation how to do this and how this relates to the dotnet cli.
推荐答案
请看以下示例: https://github.com/aspnet/Security/blob/dev/samples/CookieSample/Program.cs#L11
针对命令行进行了调整:
Tweaked for command line:
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/
这篇关于dotnet运行具有特定URL的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!