首页 > 解决方案 > 天蓝色函数 POST 方法是不允许的

问题描述

我使用 azure 函数开发了一个 web api <https://{api name}.azurewebsites.net> 并使用 VS Code 使用 POST 方法在本地对其进行了测试,它完全按照我的需要工作。但是,当我部署它(也来自 VS Code)以从邮递员那里测试和测试 POST 方法时,我收到一个405 METHOD NOT ALLOWED并且它看起来只适用于 GET。我可以看到该应用程序已从门户启动并运行,并且无法理解为什么仅当我进行以下设置时才将其限制为 GET:

# function.json

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "$return"
    }
  ]
}

任何帮助表示赞赏。我也对如何在 APP Services 下而不是在 Function APP 下部署 web api 感到困惑。我猜功能 APP 属于 APP 服务?

标签: azure-functions

解决方案


I deployed originally like this: enter image description here

But it should have been under this: enter image description here

Now it works as desired.


推荐阅读