简体   繁体   English

任务计划程序创建任务DotNet不起作用

[英]Task Scheduler Create Task DotNet not working

I am trying to schedule a task using Task Scheduler on Windows. 我正在尝试使用Windows上的任务计划程序来计划任务。 It is for a console app written with .net Core. 它是用.net Core编写的控制台应用程序。 I have created a task, set a trigger and created a new action. 我创建了一个任务,设置了一个触发器并创建了一个新动作。

When I manually run it, I get a 'Last Run Result' of 'The system cannot find the file specified. 当我手动运行它时,我得到的“上次运行结果”为“系统找不到指定的文件”。 (0x80070002)' . (0x80070002)” I have ensured that the user account running the task has access to the database on SQL Server. 我已确保运行任务的用户帐户可以访问SQL Server上的数据库。

I ran it in the command line as dotnet "C:\\Program Files\\UTDT_Database_Update\\publish\\UTDT_Database_Update.dll" and it worked successfully. 我在命令行中以dotnet“ C:\\ Program Files \\ UTDT_Database_Update \\ publish \\ UTDT_Database_Update.dll”的身份运行了它,并成功运行了。

My 'Edit Action' is as follows. 我的“编辑操作”如下。

Program/Script: dotnet 程序/脚本: dotnet

Add arguments (optional): UTDT_Database_Update.dll 添加参数(可选): UTDT_Database_Update.dll

Start in (optional): C:\\Program Files\\UTDT_Database_Update\\publish\\ 开始于(可选): C:\\ Program Files \\ UTDT_Database_Update \\ publish \\

I haven't found any solutions that work yet. 我尚未找到任何可行的解决方案。 Anyone have any ideas? 有人有想法么?

Solution was to create a batch file (.bat) that contained the following: **@ECHO OFF dotnet "C:\\Program files\\UTDT_Database_Update\\publish\\UTDT_Database_Update.dll" ** 解决方案是创建一个包含以下内容的批处理文件(.bat):** @ ECHO OFF dotnet“ C:\\ Program files \\ UTDT_Database_Update \\ publish \\ UTDT_Database_Update.dll” **

Program/Script: UTDT_Database_Update_batch.bat 程序/脚本: UTDT_Database_Update_batch.bat

Add arguments: empty 添加参数:

Start in: Location of .bat file 开始于: .bat文件的位置

This made it run. 这使其运行。 Still not sure why original task didn't work but this at least gets it to run. 仍然不确定为什么原始任务不起作用,但这至少可以使它运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 .dll的任务计划程序 - Task Scheduler with .dll 使用通用主机,HostedService,Windows Task Scheduler的dotnet控制台应用程序保持运行状态 - dotnet console app, using generic host, HostedService, Windows Task Scheduler stays in running state 处理不同结果类型时在 dotnet 核心中使用 Task.WhenAll 的最佳实践 - Best practice for working with Task.WhenAll in dotnet core, when working with different result types “GenerateDepsFile”任务意外失败:缺少 Microsoft.DotNet.PlatformAbstractions - The "GenerateDepsFile" task failed unexpectedly: Missing Microsoft.DotNet.PlatformAbstractions 如何在Task中访问软件包引用以进行dotnet构建 - How to access package references within a Task for dotnet build 通过定时后台任务在 dotnet 核心中设置 Rabbitmq 消费者 - Setup Rabbitmq consumer in dotnet core by timed background task Azure Pipeline 无法识别 dotnet cli 任务中的变量 - Azure Pipeline won't recognize variable in dotnet cli task 当前任务调度程序是否流入 ThreadPool.QueueUserWorkItem 回调? - Does the current task scheduler flow into ThreadPool.QueueUserWorkItem callbacks? 使用任务计划程序在 Windows 上计划 .Net Core 控制台应用程序 - Schedule a .Net Core console application on windows using Task Scheduler .Net Core 6 创建调度任务 - .Net Core 6 Create Scheduling Task
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM