Google App 引擎日志 "The specified framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found."
Google App Engine Logs "The specified framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found."
当 运行 我的 .net core 3.1 服务在 google 应用引擎灵活时,我会定期收到一系列错误,这些错误表面上与服务调用无关:
- "The specified framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found."
- 找到以下框架:
- 3.0.1 在 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
这些错误大约每 3-4 分钟记录一次 - 无论服务是否被调用。
开发和运行时:
- Visual Studio 2019 年 Windows 有 1 个 webapi 服务项目 (/api/values) 和一个 docker-compose 项目
- .Net Core 3.1
- Docker linux 容器
- Google App Engine 灵活
我已经阅读了几篇关于此类错误的文章,但就我而言,我没有任何 2.1.1 参考资料或代码。我的目标是 .net 核心 3.1。我该如何解决?
本地"dotnet run"或"docker run"时不会出现错误。它们只出现在 GAE 环境中。 GAE 是否依赖于 2.1.1?或者是 3.1.1 不是 "supported"
我尝试过针对 multipe 框架,但这会在应用程序中产生各种引用问题。在任何情况下,该服务都能正常运行。另一方面,查看错误日志的同事会将其用作与服务相关的所有问题的替罪羊。
问题出在解决方案,docker文件,还是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!
这种情况下的罪魁祸首是 ConfigureServices 方法中 StartUp class 的一行样板 VS 代码:
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
将代码更改为
services.AddMvc();
消除了 google 应用引擎日志中的错误消息。
当 运行 我的 .net core 3.1 服务在 google 应用引擎灵活时,我会定期收到一系列错误,这些错误表面上与服务调用无关:
- "The specified framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found."
- 找到以下框架:
- 3.0.1 在 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
这些错误大约每 3-4 分钟记录一次 - 无论服务是否被调用。
开发和运行时:
- Visual Studio 2019 年 Windows 有 1 个 webapi 服务项目 (/api/values) 和一个 docker-compose 项目
- .Net Core 3.1
- Docker linux 容器
- Google App Engine 灵活
我已经阅读了几篇关于此类错误的文章,但就我而言,我没有任何 2.1.1 参考资料或代码。我的目标是 .net 核心 3.1。我该如何解决?
本地"dotnet run"或"docker run"时不会出现错误。它们只出现在 GAE 环境中。 GAE 是否依赖于 2.1.1?或者是 3.1.1 不是 "supported"
我尝试过针对 multipe 框架,但这会在应用程序中产生各种引用问题。在任何情况下,该服务都能正常运行。另一方面,查看错误日志的同事会将其用作与服务相关的所有问题的替罪羊。
问题出在解决方案,docker文件,还是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!
这种情况下的罪魁祸首是 ConfigureServices 方法中 StartUp class 的一行样板 VS 代码:
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
将代码更改为
services.AddMvc();
消除了 google 应用引擎日志中的错误消息。