当我尝试将代码部署到门户中的 Azure 功能槽时,该消息出现在终端 VSCode 中
错误::(应用程序错误如果您是应用程序管理员,您可以访问 诊断资源。
当我检查部署日志时出现此错误:
{“代码”:“BadRequest”,“消息”:“在主机运行时遇到错误(ServiceUnavailable)。”,“目标”:null,“详细信息”:[{“消息”:“遇到错误(ServiceUnavailable)来自主机运行时。"},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","Message":"在主机运行时遇到错误 (ServiceUnavailable)。"}}] ,“内部错误”:null}
我想了解我应该有权限在槽中部署,因为我可以在生产槽中正常部署。 Idk,也许运行时出现一些错误?!
我创建了简单的 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
中添加插槽:
要从 Vs Code 部署到新槽:
OUTPUT
:New Slot
: