问题
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.
回答1:
Here are some operation might help.
Explicitly configure your App Service to use the .NET 5 stack.
Install extensions for background webjob.
You can also go to kudu for extensions installation.
来源:https://stackoverflow.com/questions/65296915/cant-execute-net-5-program-as-azure-webjob