ClickOnce应用程序未从计划程序启动 [英] ClickOnce app not starting from the scheduler

查看:78
本文介绍了ClickOnce应用程序未从计划程序启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件,该文件将启动clickOnce应用程序:

I have a batch file that will bounce a clickOnce app:

@REM The odd PING statements are to create a 5 second wait
@echo off
taskkill /F /IM MyApp.exe
PING 1.1.1.1 -n 1 -w 5000 >NUL
"%USERPROFILE%\Path\To\My\App.appref-ms"

当我双击时此方法很好它:进程被杀死,然后在5秒钟后重新启动。

This works fine when I double-click it: the process is killed and then restarted after 5 seconds.

但是,如果我安排任务,它将终止该过程,但不会重新启动它。

However, if I schedule the task, it kills the process, but doesn't restart it.

有人知道发生了什么吗? (该任务与我双击批处理文件时登录的用户身份相同,并且运行均正常)

Does anybody know what's going on? (The task is running as the same user I am logged on as when I double click the batch file and all works well)

谢谢

Ryan

推荐答案

在Windows Server 2012 R2下,我遇到了同样的问题。我的ClickOnce应用程序将在手动启动时运行,而不是从Task Scheduler启动时始终运行。

I had the same problem under Windows Server 2012 R2. My ClickOnce application would run when starting manually and not always run when started from Task Scheduler.

我发现这是由于 dfsvc.exe (ClickOnce服务助手)无法从Task Scheduler中正确启动。
我的解决方案是将任务指向一个批处理文件,该文件将在启动ClickOnce应用程序之前启动dfsvc.exe:

I found out it was due to dfsvc.exe (ClickOnce service helper) not starting up correctly from Task Scheduler. My solution was to point the Task to a batch file which would start up dfsvc.exe prior to starting the ClickOnce application :

:: Run ClickOnce service if not already running
tasklist /NH /FI "IMAGENAME eq dfsvc.exe" 2>NUL | find /I "dfsvc.exe">NUL
if errorlevel 1 start "" "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\dfsvc.exe"

\\the\path\to\your.application

这篇关于ClickOnce应用程序未从计划程序启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆