部署到 Azure Function Slot 期间出现应用程序错误

问题描述 投票:0回答:1

当我尝试将代码部署到门户中的 Azure 功能槽时,该消息出现在终端 VSCode 中

错误::(应用程序错误如果您是应用程序管理员,您可以访问 诊断资源。

当我检查部署日志时出现此错误:

{“代码”:“BadRequest”,“消息”:“在主机运行时遇到错误(ServiceUnavailable)。”,“目标”:null,“详细信息”:[{“消息”:“遇到错误(ServiceUnavailable)来自主机运行时。"},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","Message":"在主机运行时遇到错误 (ServiceUnavailable)。"}}] ,“内部错误”:null}

我想了解我应该有权限在槽中部署,因为我可以在生产槽中正常部署。 Idk,也许运行时出现一些错误?!

python deployment azure-functions continuous-integration continuous-deployment
1个回答
0
投票

我创建了简单的 Http 触发器并使用

Consumption
计划部署到 Azure 函数。

这就是我在新槽中部署函数的方式。这对我有用。

#我的代码:

productionslot

import azure.functions as func
import logging

app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)

@app.route(route="http_trigger")
def http_trigger(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    
    return func.HttpResponse(f"Hello, This HTTP triggered function executed successfully in Production slot")

newslot

    return func.HttpResponse(f"Hello, This HTTP triggered function executed successfully in a new slot")

Deployment slots
中添加插槽:

  • 启用部署槽。
  • 为插槽提供新名称。
  • 点击添加 enter image description here

enter image description here

要从 Vs Code 部署到新槽:

  • 从功能中选择新插槽。 enter image description here

OUTPUT

enter image description here

New Slot

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.