简体   繁体   English

在VS2017中使用azure函数,无法绑定到ServiceBus Queue作为输出

[英]using azure functions in VS2017, cannot bind to ServiceBus Queue as an output

I'm running Visual Studio v15.3 and trying to create an Azure Function. 我正在运行Visual Studio v15.3,并尝试创建Azure函数。 I'm having trouble binding an output to a Service Bus Queue. 我在将输出绑定到服务总线队列时遇到问题。 I get the following error when I startup: 启动时出现以下错误:

Microsoft.Azure.WebJobs.Host: Error indexing method 'CreateRawTransactions.Run'. Microsoft.Azure.WebJobs.Host:错误索引方法“ CreateRawTransactions.Run”。 Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'outputSbQueue' to type String&. Microsoft.Azure.WebJobs.Host:无法将参数'outputSbQueue'绑定为String&。 Make sure the parameter Type is supported by the binding. 确保绑定支持参数类型。 If you're using binding extensions (eg ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (eg config.UseServiceBus(), config.UseTimers(), etc.). 如果您正在使用绑定扩展(例如ServiceBus,Timer等),请确保已在启动代码中调用了扩展的注册方法(例如config.UseServiceBus(),config.UseTimers()等)。 )。

My function.cs code... 我的function.cs代码...

public static class CreateRawTransactions
{
        [FunctionName("CreateRawTransactions")]
        public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 
                                              TraceWriter log,
                                              [ServiceBus("outqueue", AccessRights.Manage, Connection = "ServiceBusConnection")] out string outputSbQueue)
        {
          outputSbQueue = "Hello ";
        }  
}

and the function.json 和function.json

{
  "bindings": [
    {
      "name": "outputSbQueue",
      "type": "serviceBus",
      "queueName": "testqueue",
      "connection": "ServiceBusConnection",
      "direction": "out",
      "accessRights": "listen"
    }
  ],
  "disabled": false

}

and the local.settings.json 和local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": ""
  },
  "ConnectionStrings": {
    "ServiceBusConnection": "Endpoint=sb://..."

  }
}

As an update, I changed the input trigger from an HttpTrigger to a ServiceBusTrigger and it works. 作为更新,我将输入触发器从HttpTrigger更改为ServiceBusTrigger,并且可以使用。 Seems like it is something to do with using an HttpTrigger. 似乎这与使用HttpTrigger有关。

This sounds like https://github.com/Azure/azure-webjobs-sdk-script/pull/1804 , and has been fixed. 这听起来像https://github.com/Azure/azure-webjobs-sdk-script/pull/1804 ,并且已经修复。 If you get an updated CLI, it should work. 如果获得更新的CLI,它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM