Google App Engine记录“未找到指定的框架'Microsoft.AspNetCore.App'版本'2.1.1'。”

当在Google App Engine flexible上运行.net core 3.1服务时,我周期性地收到一系列错误,这些错误表面上与服务调用无关:

  • “未找到指定的框架'microsoft.AspNetCore.App'版本'2.1.1'。”
  • 发现了以下框架:
  • [/ usr / share / dotnet / shared / microsoft.AspNetCore.App]中的3.0.1

这些错误大约每3-4分钟记录一次-无论是否调用该服务。

开发和运行时:

  • 带有1个webapi服务项目(/ api / values)和docker-compose项目的Windows上的Visual Studio 2019
  • .Net Core 3.1
  • Docker linux容器
  • Google App Engine灵活

我已经阅读了几篇有关此类错误的文章,但就我而言,我没有任何2.1.1参考或代码。我的目标是.net core 3.1。我该如何解决?

当我在本地“ dotnet运行”或“ docker运行”时,不会发生错误。它们仅出现在GAE环境中。 GAE是否依赖2.1.1?还是“不支持3.1.1”

我曾尝试针对Multipe框架,但这在应用程序中造成了各种参考问题。无论如何,该服务都能正常运行。另一方面,查看错误日志的同事会将其用作解决与服务相关的任何和所有问题的替罪羊。

解决方案,dockerfile或GAE中的问题也是吗?

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
# EXPOSE 80
# EXPOSE 443
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
ADD dev-certificate.pfx /usr/local/share/ca-certificates/dev-certificate.crt
RUN update-ca-certificates
COPY Xxxxx.Orchestrations.Cost/Xxxxx.Orchestrations.Cost.csproj Xxxxx.Orchestrations.Cost/
RUN dotnet restore "Xxxxx.Orchestrations.Cost/Xxxxx.Orchestrations.Cost.csproj"
COPY . .
WORKDIR "/src/Xxxx.Orchestrations.Cost"
RUN dotnet build "Xxxxx.Orchestrations.Cost.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Xxxxx.Orchestrations.Cost.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
# CMD chmod /app/publish/dev-certificate.pfx +rrr


# ENV ASPNETCORE_ENVironMENT=Development
ENV ASPNETCORE_URLS=http://*:8080;https://*:443
ENV ASPNETCORE_HTTPS_PORT=443
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=dev-certificate.pfx
ENV ASPNETCORE_Kestrel__Certificates__Default__Password=ufo
ENTRYPOINT ["dotnet","Xxxxx.Orchestrations.Cost.dll"]

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

network:
    name: default
    subnetwork_name: default-us-east1

service: get-cost

env_variables:
  # The __ in My__Greeting will be translated to a : by ASP.NET.
  My__Greeting: Hello AppEngine Flex!
spoonlee 回答:Google App Engine记录“未找到指定的框架'Microsoft.AspNetCore.App'版本'2.1.1'。”

这种情况下的罪魁祸首是ConfigureServices方法中StartUp类的样板VS代码:

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

将代码更改为

services.AddMvc(); 

消除了Google App Engine日志中的错误消息。

本文链接:https://www.f2er.com/2938389.html

大家都在问