我试图在应用程序引擎上部署。net 7应用程序,但我得到以下错误:
错误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
如果我理解得好,似乎服务器缺少正确的dotnet版本来运行应用程序。这些是我的app.yaml和Dockerfile:
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"]
正如Jon Skeet指出的那样,我只需要将项目从。net 6重新定位到。net 7。