【发布时间】:2018-08-08 07:34:32
【问题描述】:
我正在尝试使用 dotnet core 2.0 运行 Windows 调度程序任务。 问题是我必须指定 IIS 本地主机端口才能执行下面代码中显示的任务。
我想在不使用“.UseUrls("http://localhost:8089")”代码的情况下执行任务。
public class Program
{
public static void Main(string[] args)
{
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
var pathToContentRoot = Path.GetDirectoryName(pathToExe);
var host = WebHost.CreateDefaultBuilder(args)
.UseContentRoot(pathToContentRoot)
.UseUrls("http://localhost:8089")
.UseStartup<Startup>().Build();
host.RunAsCustomService();
}
}
【问题讨论】:
-
“我正在尝试使用 dotnet core 2.0 运行 Windows 调度程序任务” - 你能解释一下你想要实现的目标吗?当您说“Windows 调度程序任务”时,我是否理解您的意思是“计划任务”?
标签: c# asp.net-core-2.0