.NET 5.0 Webjob 不再以独立构建开始
.NET 5.0 Webjob no longer starting with self-contained build
由于 .NET 5.0,我将我的构建切换为独立构建。我知道有一个预览运行时,但我不想为我的生产环境打赌。我遇到了预览运行时无意中切换回来的情况(例如横向扩展)。
dotnet publish --configuration release --self-contained true --runtime win-x64
完成独立构建后,我的网络作业不再启动。在查看日志时,我刚刚发现:
[12/22/2020 16:36:05 > 62427f: SYS INFO] Detected WebJob file/s were updated, refreshing WebJob
[12/22/2020 16:36:05 > 62427f: SYS INFO] Status changed to Starting
[12/22/2020 16:36:05 > 62427f: SYS INFO] WebJob singleton setting is False
[12/22/2020 16:36:07 > 62427f: SYS INFO] Run script 'createdump.exe' with script host - 'WindowsScriptHost'
[12/22/2020 16:36:07 > 62427f: SYS INFO] Status changed to Running
[12/22/2020 16:36:35 > 62427f: ERR ] createdump [options] pid
[12/22/2020 16:36:35 > 62427f: ERR ] -f, --name - dump path and file name. The default is '%TEMP%\dump.%p.dmp'. These specifiers are substituted with following values:
[12/22/2020 16:36:35 > 62427f: ERR ] %p PID of dumped process.
[12/22/2020 16:36:35 > 62427f: ERR ] %e The process executable filename.
[12/22/2020 16:36:35 > 62427f: ERR ] %h Hostname return by gethostname().
[12/22/2020 16:36:35 > 62427f: ERR ] %t Time of dump, expressed as seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
[12/22/2020 16:36:35 > 62427f: ERR ] -n, --normal - create minidump.
[12/22/2020 16:36:35 > 62427f: ERR ] -h, --withheap - create minidump with heap (default).
[12/22/2020 16:36:35 > 62427f: ERR ] -t, --triage - create triage minidump.
[12/22/2020 16:36:35 > 62427f: ERR ] -u, --full - create full core dump.
[12/22/2020 16:36:35 > 62427f: ERR ] -d, --diag - enable diagnostic messages.
[12/22/2020 16:36:36 > 62427f: SYS ERR ] Job failed due to exit code -1
[12/22/2020 16:36:36 > 62427f: SYS INFO] Process went down, waiting for 60 seconds
[12/22/2020 16:36:36 > 62427f: SYS INFO] Status changed to PendingRestart
这个 createddump 日志输出是什么意思?
进行独立构建时,您的构建输出文件夹将包含一个 createdump.exe
文件。将 WebJob 部署到 App Service 时,它现在将选择此 .exe 而不是您的 WebJob。这就是日志显示 createdump.exe.
的 CLI 输出的原因
解决方法:创建一个 run.cmd
文件,其中仅包含您的 mywebjob.exe
.
的名称
https://github.com/projectkudu/kudu/wiki/WebJobs
- Per file type we look first for a file named: run.{file type extension} (for example run.cmd or run.exe).
- If it doesn't exists for all file types, we'll then look for the first file with a supported file type extension.
- The order of file types extension used is: .cmd, .bat, .exe, .ps1, .sh, .php, .py, .js.
- The recommended script file to have in your job directory is: run.cmd.
- Note: We'll only look for a script under the root directory of that job (not under sub directories of it).
- Note: make sure .bat/.cmd files don't include the UTF-8 BOM (inserted by some editors such as Visual Studio by default), which can break things!
PS:您不能简单地删除 createdump.exe,因为您的应用会 not start without it。
由于 .NET 5.0,我将我的构建切换为独立构建。我知道有一个预览运行时,但我不想为我的生产环境打赌。我遇到了预览运行时无意中切换回来的情况(例如横向扩展)。
dotnet publish --configuration release --self-contained true --runtime win-x64
完成独立构建后,我的网络作业不再启动。在查看日志时,我刚刚发现:
[12/22/2020 16:36:05 > 62427f: SYS INFO] Detected WebJob file/s were updated, refreshing WebJob
[12/22/2020 16:36:05 > 62427f: SYS INFO] Status changed to Starting
[12/22/2020 16:36:05 > 62427f: SYS INFO] WebJob singleton setting is False
[12/22/2020 16:36:07 > 62427f: SYS INFO] Run script 'createdump.exe' with script host - 'WindowsScriptHost'
[12/22/2020 16:36:07 > 62427f: SYS INFO] Status changed to Running
[12/22/2020 16:36:35 > 62427f: ERR ] createdump [options] pid
[12/22/2020 16:36:35 > 62427f: ERR ] -f, --name - dump path and file name. The default is '%TEMP%\dump.%p.dmp'. These specifiers are substituted with following values:
[12/22/2020 16:36:35 > 62427f: ERR ] %p PID of dumped process.
[12/22/2020 16:36:35 > 62427f: ERR ] %e The process executable filename.
[12/22/2020 16:36:35 > 62427f: ERR ] %h Hostname return by gethostname().
[12/22/2020 16:36:35 > 62427f: ERR ] %t Time of dump, expressed as seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
[12/22/2020 16:36:35 > 62427f: ERR ] -n, --normal - create minidump.
[12/22/2020 16:36:35 > 62427f: ERR ] -h, --withheap - create minidump with heap (default).
[12/22/2020 16:36:35 > 62427f: ERR ] -t, --triage - create triage minidump.
[12/22/2020 16:36:35 > 62427f: ERR ] -u, --full - create full core dump.
[12/22/2020 16:36:35 > 62427f: ERR ] -d, --diag - enable diagnostic messages.
[12/22/2020 16:36:36 > 62427f: SYS ERR ] Job failed due to exit code -1
[12/22/2020 16:36:36 > 62427f: SYS INFO] Process went down, waiting for 60 seconds
[12/22/2020 16:36:36 > 62427f: SYS INFO] Status changed to PendingRestart
这个 createddump 日志输出是什么意思?
进行独立构建时,您的构建输出文件夹将包含一个 createdump.exe
文件。将 WebJob 部署到 App Service 时,它现在将选择此 .exe 而不是您的 WebJob。这就是日志显示 createdump.exe.
解决方法:创建一个 run.cmd
文件,其中仅包含您的 mywebjob.exe
.
https://github.com/projectkudu/kudu/wiki/WebJobs
- Per file type we look first for a file named: run.{file type extension} (for example run.cmd or run.exe).
- If it doesn't exists for all file types, we'll then look for the first file with a supported file type extension.
- The order of file types extension used is: .cmd, .bat, .exe, .ps1, .sh, .php, .py, .js.
- The recommended script file to have in your job directory is: run.cmd.
- Note: We'll only look for a script under the root directory of that job (not under sub directories of it).
- Note: make sure .bat/.cmd files don't include the UTF-8 BOM (inserted by some editors such as Visual Studio by default), which can break things!
PS:您不能简单地删除 createdump.exe,因为您的应用会 not start without it。