部署.NET 7应用至Google App Engine失败,提示缺少.NET 6运行时
部署.NET 7应用至Google App Engine灵活环境时遇到版本依赖错误
错误信息
Updating service [default] (this may take several minutes)...failed. ERROR: (gcloud.app.deploy) Error Response: [9] An internal error occurred while processing task /app-engine-flex/flex_await_healthy/flex_await_healthy>2022-12-01T04:02:39.227Z143518.vt .1: You must install or update .NET to run this application. App: /app/Cyclee.API.dll Architecture: x64 Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64) .NET location: /usr/share/dotnet/ The following frameworks were found: 7.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App] Learn about framework resolution: https://aka.ms/dotnet/app-launch-failed To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=debian.11-x64
我清楚这是服务器缺少应用运行所需的正确.NET版本导致的,以下是我的配置文件:
配置文件
app.yaml
runtime: custom env: flex # This sample incurs costs to run on the App Engine flexible environment. # The settings below are to reduce costs during testing and are not appropriate # for production use. For more information, see: # https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml manual_scaling: instances: 1 resources: cpu: 1 memory_gb: 0.5 disk_size_gb: 10 env_variables: ConnectionStrings__SqlDatabase:
Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 8080 EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src COPY ["Cyclee.API/Cyclee.API.csproj", "Cyclee.API/"] COPY ["Cyclee.API.Domain/Cyclee.API.Domain.csproj", "Cyclee.API.Domain/"] COPY ["Cyclee.API.Infrastructure/Cyclee.API.Infrastructure.csproj", "Cyclee.API.Infrastructure/"] RUN dotnet restore "Cyclee.API/Cyclee.API.csproj" COPY . . WORKDIR "/src/Cyclee.API" RUN dotnet build "Cyclee.API.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "Cyclee.API.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Cyclee.API.dll"]
内容的提问来源于stack exchange,提问作者Vico
相关产品推荐
相关产品推荐

