计划任务失败-未指定错误 [英] Scheduled task fails - Unspecified Error
问题描述
我有一个c#控制台应用程序,可将数据上传到Sitecore/UCommerce实施中.它基于UCommerce UConnector.当我从命令行运行此命令时,它会毫无问题地执行,所有数据都会正确上传和下载,而不会出现错误.当我尝试安排此任务时,它退出并显示0xffffff
错误.该任务指定一个命令行参数,该参数将应用程序设置为从App.Config
I have a c# console app that uploads data to a Sitecore/UCommerce implementation. It is based on the UCommerce UConnector. When I run this from the command line it executes without a problem all data is uploaded and downloaded correctly without error. When I try to schedule this task it exits with a 0xffffff
error. The task specifies a command line parameter that sets the app to read all configurable options from the App.Config
我已经搜索了此错误,发现了很多尝试过的建议,但是都没有解决该问题的方法.我尝试过的事情包括:
I have search this error and found many suggestions which I have tried but none are solving this problem. Things I have tried include:
- 输入开始参数
- 检查具有最高特权的跑步
- 将控制台应用程序转换为没有表单的Windows窗体应用程序
- 使用管理员帐户运行任务
- 在应用程序所在的文件夹上设置安全权限,以完全控制
- 在系统帐户下运行
- 尝试在服务器(Windows Server 2012)和工作站(Windows 7)上运行相同的任务
这些都没有任何不同.未登录事件查看器.应用程序中的错误日志记录(SQL)不会记录任何内容.
None of these have made any difference. Nothing in logged in the event viewer. The error logging (SQL) in the app logs nothing.
我不知道这是否有任何相关性,但是该应用程序使用的是NHibernate,Castle Windsor,当然还有UCommerce.
I don't know if this has any relevance but the app is using NHibernate, Castle Windsor and of course UCommerce.
有人可以建议我还没有尝试过的东西吗?或建议我如何找出可能的错误.
Can anyone suggest anything I have not yet tried? Or suggest how I can find out what the error might be.
修改
这是所请求的命令行命令
Here is the command line command as requested
更新
(我已删除了路径中的所有空格,以防万一导致问题,因此下面的命令与上面的图像是不同的路径)
我设法在服务器上更改了配置并创建了一个批处理文件.我还更改了应用程序所在的文件夹,因此路径中没有空格.在我拥有的批处理文件中
I have managed to get the config changed on the server and create a batch file. I have also changed the folder the app is in so there are no spaces in the path. in the batch file I have
cmd /c F:\SCProcessor\Orders\SiteConnector.exe /cfg
在任务计划程序中报告同样的错误
I have the same error being repored in Task Scheduler
如果我双击批处理文件,它将完美运行.如果将/c
更改为/k
(希望在命令窗口中看到错误报告),则不会显示任何窗口,并且直到我结束该任务后,任务才会停止运行.
If I double click the batch file it runs perfectly. If I change the /c
to /k
(hoping to see an error reported in the command window) no window shows and the task does not stop running until I end it.
推荐答案
好,我已经解决了自己的问题.花了一段时间才找出问题所在,但最终我通过在SSMS和xp_cmdshell
中运行它来发现了问题.该报告说它找不到配置文件
Ok I have fixed my own problem. It took a while to find out what the problem actually was but eventually I found it by running this in SSMS and xp_cmdshell
. This reported back that it could not find a config file
C:\ windows \ system32 \ app_config \ prefetch \ Common.config
C:\windows\system32\app_config\prefetch\Common.config
app_config是控制台apps文件夹中的文件夹.在SiteConnector.exe.config中,有许多包含项,可以引入各种配置:
app_config is a folder in the console apps folder. In the SiteConnector.exe.config is a number of includes that pull in various configs:
<sc.include file="App_Config/Prefetch/Common.config"/>
无论出于何种原因(我仍然必须弄清原因),它都可以解决:
For whatever reason (and I still have to work out why) this resolves to:
C:\ windows \ system32 \ app_config \ prefetch \ Common.config
C:\windows\system32\app_config\prefetch\Common.config
从任务计划程序或SQL作业中调用它时,但是:
When calling it from task scheduler or a SQL job but:
F:\ SCProcessor \ Orders \ app_config \ prefetch \ Common.config
F:\SCProcessor\Orders\app_config\prefetch\Common.config
从命令提示符运行时.
我将include的路径更改为绝对路径,此问题已解决.只需将SiteConnector.exe.config
更新为
I changed the paths for the includes to absolute paths and the problem is fixed. Just need to update the SiteConnector.exe.config
to something like
<sc.include file="{$CurrentFolder}/App_Config/Prefetch/Common.config"/>
如果可能的话.
这篇关于计划任务失败-未指定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!