【发布时间】:2019-12-13 03:01:52
【问题描述】:
在 google app engine flexible 上运行我的 .net core 3.1 服务时,我会定期收到一系列错误,这些错误表面上与服务调用无关:
- “未找到指定的框架‘Microsoft.AspNetCore.App’,版本‘2.1.1’。”
- 找到了以下框架:
- 3.0.1 在 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
这些错误大约每 3-4 分钟记录一次 - 无论服务是否被调用。
开发和运行时:
- Windows 上的 Visual Studio 2019,带有 1 个 webapi 服务项目 (/api/values) 和一个 docker-compose 项目
- .Net Core 3.1
- Docker linux 容器
- Google App Engine 灵活
我已经阅读了几篇关于此类错误的文章,但就我而言,我没有任何 2.1.1 参考或代码。我的目标是.net core 3.1。我该如何解决?
当我在本地“dotnet run”或“docker run”时不会发生错误。它们只出现在 GAE 环境中。 GAE 是否依赖于 2.1.1?还是 3.1.1 不受“支持”
我尝试过针对多个框架,但这会在应用程序中产生各种参考问题。无论如何,服务正常运行。另一方面,查看错误日志的同事会将其用作与服务相关的任何和所有问题的替罪羊。
那么是解决方案、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!
【问题讨论】:
-
你的 app.yaml 中有 specified
runtime: custom行吗? -
我在实验后忘记将其改回自定义,但在将其返回自定义后仍然出现错误,如我添加到原始问题的代码中所示。
标签: docker google-app-engine asp.net-core-3.1