How*_*amp 8 c# azure azure-functions
我有一个简单的Azure函数,我为其设置了一个DocumentDB输出(作为示例):
然后我将outputDocument参数添加到函数中并在代码中为其分配了一个值(顺便说一下,当我设置输出时运行时没有自动修改函数签名时,我很惊讶):
using System;
public static void Run(string input, out object outputDocument, TraceWriter log)
{
log.Info($"C# manually triggered function called with input: {input}");
outputDocument = new {
text = $"I'm running in a C# function! {input}"
};
}
Run Code Online (Sandbox Code Playgroud)
当我运行该函数时,Azure Functions运行时执行它的绑定魔术并创建DocumentDB文档.
然后我设置了一个HTTP输出:
并定义了res输出参数.
但现在呢?分配给res的过程是什么?我当然要定义目的地,请求类型,参数等.
Howiecamp,
HTTP输出绑定与HTTP触发器一起使用,以充当HTTP请求的响应处理程序.
目前,没有输出绑定可以通过HTTP为您发送输出有效负载,因此您需要从您的功能代码发出该HTTP请求(例如,使用HttpClient并发出请求).您可以在我们的模板中看到一个示例:https://github.com/Azure/azure-webjobs-sdk-templates/blob/10650dbf9c4bad75b0c89b9c355edc53fe913cde/Templates/GitHubCommenter-CSharp/run.csx#L40-L49
我希望这有帮助!
| 归档时间: |
|
| 查看次数: |
3779 次 |
| 最近记录: |