您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Azure Functions HTTP 触发器和绑定概述Azure Functions HTTP triggers and bindings overview

Azure Functions 可以通过 HTTP 请求进行调用,以生成无服务器 Api 和响应webhookAzure Functions may be invoked via HTTP requests to build serverless APIs and respond to webhooks.

操作Action 类型Type
从 HTTP 请求运行函数Run a function from an HTTP request 触发器Trigger
从函数返回 HTTP 响应Return an HTTP response from a function 输出绑定Output binding

本文中的代码默认为 .NET Core 语法,在函数版本2.x 和更高版本中使用。The code in this article defaults to .NET Core syntax, used in Functions version 2.x and higher. 有关 1.x 语法的信息,请参阅 1.x functions 模板For information on the 1.x syntax, see the 1.x functions templates.

添加到函数应用Add to your Functions app

函数1.x 和更高版本Functions 2.x and higher

使用触发器和绑定需要引用适当的包。Working with the trigger and bindings requires that you reference the appropriate package. NuGet 包用于 .NET 类库,而扩展捆绑用于所有其他应用程序类型。The NuGet package is used for .NET class libraries while the extension bundle is used for all other application types.

语言Language 添加依据 。Add by... 备注Remarks
C#C# 安装NuGet 包版本2。xInstalling the NuGet package, version 3.x
C#脚本、Java、JavaScript、Python、PowerShellC# Script, Java, JavaScript, Python, PowerShell 注册扩展捆绑Registering the extension bundle 建议将Azure 工具扩展用于 Visual Studio Code。The Azure Tools extension is recommended to use with Visual Studio Code.
C#脚本(仅在 Azure 门户中为联机)C# Script (online-only in Azure portal) 添加绑定Adding a binding 若要更新现有绑定扩展,而不必重新发布函数应用,请参阅更新扩展To update existing binding extensions without having to republish your function app, see Update your extensions.

Functions 1.xFunctions 1.x

函数1.x 应用程序会自动引用Microsoft Azure Web 作业NuGet 包版本2.x。Functions 1.x apps automatically have a reference the Microsoft.Azure.WebJobs NuGet package, version 2.x.

后续步骤Next steps