无法将.net 5程序作为Azure WebJob执行 [英] Can't execute .net 5 program as Azure WebJob

查看:75
本文介绍了无法将.net 5程序作为Azure WebJob执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net 5命令行程序,我试图按计划在Azure上以webjob的身份执行该程序.我可以在本地执行它而不会出现问题,但是在Azure上执行时,我得到:

  [2020年12月14日21:28:03>83e1e9:SYS INFO]状态更改为正在初始化"[12/14/2020 21:28:10>83e1e9:SYS INFO]使用脚本宿主-"WindowsScriptHost"运行脚本"ApplySupportTool.ServerTasks.exe"[12/14/2020 21:28:11>83e1e9:SYS INFO]状态更改为正在运行"[12/14/2020 21:28:11>83e1e9:错误]无法找到任何兼容的框架版本[12/14/2020 21:28:11>83e1e9:错误]找不到框架'Microsoft.NETCore.App',版本'5.0.0'.[12/14/2020 21:28:11>83e1e9:ERR]-找到以下框架:[12/14/2020 21:28:11>83e1e9:ERR] 2.2.14,位于[D:\ Program Files \ dotnet \ shared \ Microsoft.NETCore.App][12/14/2020 21:28:11>83e1e9:ERR] 3.0.3 at [D:\ Program Files \ dotnet \ shared \ Microsoft.NETCore.App][12/14/2020 21:28:11>83e1e9:ERR] 3.1.8 at [D:\ Program Files \ dotnet \ shared \ Microsoft.NETCore.App][12/14/2020 21:28:11>83e1e9:ERR][12/14/2020 21:28:11>83e1e9:ERR]您可以通过安装指定的框架和/或SDK来解决此问题.[12/14/2020 21:28:11>83e1e9:ERR][12/14/2020 21:28:11>83e1e9:ERR]可在以下位置找到指定的框架:[12/14/2020 21:28:11>83e1e9:错误]-https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=win10-x64[12/14/2020 21:28:11>83e1e9:SYS INFO]状态更改为失败"[12/14/2020 21:28:11>83e1e9:SYS ERR]作业由于退出代码-2147450730而失败 

但是根据我在这里看到的内容:

  • 为后台网络作业安装扩展程序.

  • 您也可以转到kudu进行扩展程序安装.

  • I have a .net 5 command line programm which I try to execute on a schedule as webjob on Azure. I can execute it without issues locally, but when execute on Azure I get:

    [12/14/2020 21:28:03 > 83e1e9: SYS INFO] Status changed to Initializing
    [12/14/2020 21:28:10 > 83e1e9: SYS INFO] Run script 'ApplySupportTool.ServerTasks.exe' with script host - 'WindowsScriptHost'
    [12/14/2020 21:28:11 > 83e1e9: SYS INFO] Status changed to Running
    [12/14/2020 21:28:11 > 83e1e9: ERR ] It was not possible to find any compatible framework version
    [12/14/2020 21:28:11 > 83e1e9: ERR ] The framework 'Microsoft.NETCore.App', version '5.0.0' was not found.
    [12/14/2020 21:28:11 > 83e1e9: ERR ]   - The following frameworks were found:
    [12/14/2020 21:28:11 > 83e1e9: ERR ]       2.2.14 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    [12/14/2020 21:28:11 > 83e1e9: ERR ]       3.0.3 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    [12/14/2020 21:28:11 > 83e1e9: ERR ]       3.1.8 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    [12/14/2020 21:28:11 > 83e1e9: ERR ] 
    [12/14/2020 21:28:11 > 83e1e9: ERR ] You can resolve the problem by installing the specified framework and/or SDK.
    [12/14/2020 21:28:11 > 83e1e9: ERR ] 
    [12/14/2020 21:28:11 > 83e1e9: ERR ] The specified framework can be found at:
    [12/14/2020 21:28:11 > 83e1e9: ERR ]   - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=win10-x64
    [12/14/2020 21:28:11 > 83e1e9: SYS INFO] Status changed to Failed
    [12/14/2020 21:28:11 > 83e1e9: SYS ERR ] Job failed due to exit code -2147450730
    

    But from what I read here: https://azure.github.io/AppService/2020/11/10/Dot-Net-5-on-App-Service.html .net 5 is already available through all regions. Also, my .net 5 asp.net core web api project works without issues on the same app service. I also tried to install it explicitly via the ASP.NET Core 5.0 (x86) Runtime, but with no different result. I know that I can publish it as self contained. Given the size increase I would prefer to use the installed version though.

    解决方案

    Here are some operation might help.

    1. Explicitly configure your App Service to use the .NET 5 stack.

    2. Install extensions for background webjob.

    3. You can also go to kudu for extensions installation.

    这篇关于无法将.net 5程序作为Azure WebJob执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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