最后,App Service 可以在 Linux 容器下的 .NET 8 Preview 上运行(尚不支持 Windows)。我创建了一个并部署了一个简单的应用程序,但容器没有启动,如下所示:
2023-09-17T20:25:27.314076959Z The following frameworks were found:
2023-09-17T20:25:27.314080459Z 8.0.0-preview.7.23375.6 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2023-09-17T20:25:27.314084859Z
2023-09-17T20:25:27.314088060Z Learn more:
2023-09-17T20:25:27.314103160Z https://aka.ms/dotnet/app-launch-failed
2023-09-17T20:25:27.314106760Z
2023-09-17T20:25:27.314110060Z To install missing framework, download:
2023-09-17T20:25:27.314113460Z https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0-rc.1.23419.4&arch=x64&rid=linux-x64&os=debian.12
2023-09-17T20:25:28.143Z ERROR - Container mytestsite_0_6514069e for site mytestsite has exited, failing site start
2023-09-17T20:25:28.165Z ERROR - Container mytestsite_0_6514069e didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2023-09-17T20:25:28.168Z INFO - Stopping site mytestsite because it failed during startup.
应用程序日志中的类似内容(尽管全部显示为绿色,“确定”):
2023-09-17T20:05:29.1782264 Trying to find the startup DLL name...
2023-09-17T20:05:29.1785581 Found the startup D name: Test.Api.dll
2023-09-17T20:05:29.1786987 Running the command: dotnet "Test.Api.dll"
2023-09-17T20:05:29.2267788 You must install or update .NET to run this application.
2023-09-17T20:05:29.2268172 App: /home/site/wwwroot/Test.Api.dll
2023-09-17T20:05:29.226821 Architecture: x64
2023-09-17T20:05:29.227199 Framework: 'Microsoft.NETCore.App', version '8.0.0-rc.1.23419.4' (x64)
2023-09-17T20:05:29.227326 .NET location: /usr/share/dotnet/
我替换了参考rc
包裹由preview
类似的包8.0.0-preview.7.23375.9
在我的应用程序中,但它没有帮助,同样的错误。
我想知道是否可以手动将 8.0.0-rc.1.23419.4 安装到 Linux 计算机上,以及为什么它会要求它,因为 Visual Studio 项目文件中没有声明直接依赖项。在发布过程中创建了一个名为 Test.Api.runtimeconfig.json 的文件,它指向 8.0.0-rc,但我不确定它是如何在文件内创建和管理的:
{
"name": "Microsoft.AspNetCore.App",
"version": "8.0.0-rc.1.23421.29"
}
我认为有两种方法可以修复它:1)手动将 8.0.0-rc 安装到 Linux 机器上,或者 2)以某种方式更新 github yml 脚本,以指示它在构建操作之前将特定版本的 .net 安装到 Linux 机器上