【问题标题】:Trying to execute azure functions in vscode尝试在 vscode 中执行天蓝色函数
【发布时间】:2021-04-05 14:38:56
【问题描述】:

我一直在尝试部署具有 azure 功能的烧瓶应用程序。它不工作。 我是天蓝色的新手...

我的烧瓶应用程序是一个简单的计算器,我想在线使用 azure 函数。 我的文件目录如下:

flaskapp
      |-flask application;
      |-index.html
azure_function:HTTP trigger function
      |-__init__.py
      |-function.json

这是我的 init.py

def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:

    return func.WsgiMiddleware(application).handle(req, context)

当我尝试在 vs 代码中本地调试我的函数时,我无法使其工作:找不到 404。 当我执行函数时,我得到:执行函数“functionName”。回复:"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>404 Not Found</title> <h1>Not Found</h1> <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p> "

有人可以帮帮我吗?

【问题讨论】:

  • 很多信息丢失了。功能的触发器/绑定是什么?你如何“执行功能”?例如。在 Portal 上或在 CLI 或 Postman/curl 上的笔记本电脑上或...?您在哪里看到您提到的回复?在日志文件中,在 UI 上,在 CLI 上.. ?
  • 我这边没问题。有日志吗?
  • 在哪里可以找到日志@BowmanZhu?
  • 转到C:\Users\yourusernameonlocal\AppData\Local\Temp\LogFiles\Application\Functions\Function\yourfunctionname
  • VSCode的终端应该会显示日志。

标签: python-3.x visual-studio-code azure-functions


【解决方案1】:

这个问题需要更多细节。

404 Not found 错误总是意味着你错过了一些基本的东西。本地烧瓶应用程序的默认端口与本地的azure函数不同(azure函数为7071)。

调试 azure 函数并不意味着只调试 __init__.py。其实就是调试整个函数应用(需要安装azure函数核心工具、VSCode的azure函数插件和语言调试插件)。

【讨论】:

  • 我只是更改了问题,以获得更多详细信息
猜你喜欢
  • 1970-01-01
  • 2020-03-31
  • 1970-01-01
  • 1970-01-01
  • 2018-03-22
  • 1970-01-01
  • 1970-01-01
  • 2021-06-12
  • 1970-01-01
相关资源
最近更新 更多