【问题标题】:How to deploy a .net5 app to Google Cloud Appengine?如何将 .net5 应用部署到 Google Cloud Appengine?
【发布时间】:2021-07-11 17:54:06
【问题描述】:

我正在尝试将 .net 5 项目部署到 google 应用引擎,但是当我想使用 .net5 运行时进行构建时似乎出现了问题。

这是我的 app.yaml

runtime: aspnetcore
env: flex
service: api
# 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

将应用程序发送到 gcloud 后,我收到此错误:

第 0 步:gcr.io/gcp- 运行时/aspnetcorebuild@sha256:f5552a5efdaf278a3124ea10fd1c96fg36b09fc9f98f9e620cbd71279797576b3f 第 0 步:找不到应用的 .deps.json 文件

奇怪的是,当我在 gcloud 终端中写入“dotnet --version”时,它会响应:3.1.407 有没有办法从谷歌云更新 dotnet 运行时和 sdk ?

【问题讨论】:

    标签: asp.net-core google-app-engine google-cloud-platform gcloud


    【解决方案1】:

    我终于下载了Visual Studio的谷歌云工具,显然,应用引擎暂时不支持.net 5。

    第 0 步:应用需要 .NET Core 运行时版本 5,目前不支持。

    【讨论】:

    • App Engine flex 部署容器。虽然 Google 为多个运行时版本提供运行时,但您可以使用任何具有 HTTP 服务器的 Dockerfile 侦听端口 8080跨度>
    • 看这个; google.com/amp/s/cloudblog.withgoogle.com/topics/… Cloud Run 用的,原理基本一样,要保证服务器在 8080 上运行
    • 我实际上正在使用 cloudrun 进行部署,一切正常。我试图在silution中使用dockerfile部署到appengine flex,但它阻止了我,因为有一个dockerfile并且应该只是一个app.yaml。我会再试一次 flex 但我很确定它不起作用。
    • Cloud Run 不错,但如果您更喜欢使用 App Engine,我相信它可以在 App Engine 上运行。您需要使用 runtime: custom 以便该工具获取 Dockerfile。请参阅:cloud.google.com/appengine/docs/flexible/custom-runtimes/… 唯一的硬性要求是容器在 8080 上侦听,但这与 PORT 的 Cloud Run 要求非常相似,所以我认为您只需要调整 app.yaml
    猜你喜欢
    • 1970-01-01
    • 2020-09-01
    • 2014-06-11
    • 2018-10-19
    • 1970-01-01
    • 1970-01-01
    • 2017-04-09
    • 2017-04-23
    • 2017-02-12
    相关资源
    最近更新 更多