相关疑难解决方法(0)

如何将输出值绑定到异步Azure功能?

如何将输出绑定到异步函数?设置参数的常用方法out不适用于异步函数.

using System;

public static async void Run(string input, TraceWriter log, out string blobOutput)
{
    log.Info($"C# manually triggered function called with input: {input}");
    await Task.Delay(1);

    blobOutput = input;
}
Run Code Online (Sandbox Code Playgroud)

这导致编译错误:

[timestamp] (3,72): error CS1988: Async methods cannot have ref or out parameters
Run Code Online (Sandbox Code Playgroud)

使用绑定(fyi)

{
  "bindings": [
    {
      "type": "blob",
      "name": "blobOutput",
      "path": "testoutput/{rand-guid}.txt",
      "connection": "AzureWebJobsDashboard",
      "direction": "out"
    },
    {
      "type": "manualTrigger",
      "name": "input",
      "direction": "in"
    }
  ],
  "disabled": false
}
Run Code Online (Sandbox Code Playgroud)

c# asynchronous azure azure-functions

15
推荐指数
1
解决办法
5968
查看次数

标签 统计

asynchronous ×1

azure ×1

azure-functions ×1

c# ×1