ClickOnce应用程序未从计划程序启动

编程入门 行业动态 更新时间:2024-10-11 19:23:05
本文介绍了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应用程序未从计划程序启动

本文发布于:2023-11-07 15:58:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   计划   程序   ClickOnce

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!