【问题标题】:Run an exe from the run.ps1 of an Azure WebJob从 Azure WebJob 的 run.ps1 运行 exe
【发布时间】:2018-01-08 07:03:32
【问题描述】:

我正在尝试在 Azure 门户中进行部署。部署完成后,它将从一个 powershell 脚本开始,该脚本将启动位于同一目录中的可执行文件

run.ps1(脚本)的内容

& ScrapperProcessor.exe

其中“ScrapperProcessor.exe”是可执行文件的名称。

“run.ps1”和“ScrapperProcessor.exe”的父文件夹都称为“Debug”

我得到以下日志:

[01/08/2018 06:27:52 > f328c1: SYS INFO] Status changed to Initializing
[01/08/2018 06:27:58 > f328c1: SYS INFO] Run script 'run.ps1' with script host - 'PowerShellScriptHost'
[01/08/2018 06:27:58 > f328c1: SYS INFO] Status changed to Running
[01/08/2018 06:28:07 > f328c1: ERR ] & : The term 'ScrapperProcessor.exe' is not recognized as the name of a 
[01/08/2018 06:28:07 > f328c1: ERR ] cmdlet, function, script file, or operable program. Check the spelling of the 
[01/08/2018 06:28:07 > f328c1: ERR ] name, or if a path was included, verify that the path is correct and try again.
[01/08/2018 06:28:07 > f328c1: ERR ] At D:\local\Temp\jobs\triggered\Scr7\xbs0kgzn.2e4\Debug\run.ps1:1 char:3
[01/08/2018 06:28:07 > f328c1: ERR ] + & ScrapperProcessor.exe
[01/08/2018 06:28:07 > f328c1: ERR ] +   ~~~~~~~~~~~~~~~~~~~~~
[01/08/2018 06:28:07 > f328c1: ERR ]     + CategoryInfo          : ObjectNotFound: (ScrapperProcessor.exe:String) [ 
[01/08/2018 06:28:07 > f328c1: ERR ]    ], CommandNotFoundException
[01/08/2018 06:28:07 > f328c1: ERR ]     + FullyQualifiedErrorId : CommandNotFoundException
[01/08/2018 06:28:07 > f328c1: ERR ]  
[01/08/2018 06:28:07 > f328c1: SYS INFO] Status changed to Success

知道为什么这不起作用吗?

【问题讨论】:

  • 如果要运行 .exe 文件。您需要将其重命名为run.exefirst。您可以在此文档中查看更多详细信息:github.com/projectkudu/kudu/wiki/WebJobs
  • .exe 文件是从 Visual Studio 项目编译的。我不能更改它的名称,否则我会在运行时遇到异常。我那里还有其他 .exe 文件,但我只打算运行 ScrapperProcessor.exe

标签: powershell azure azure-webjobs azureportal


【解决方案1】:

你只需要改变:

& ScrapperProcessor.exe

& .\ScrapperProcessor.exe

【讨论】:

    猜你喜欢
    • 2020-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多