简体   繁体   English

输入绑定到自定义类似乎不适用于blob

[英]Input binding to custom class doesn't seem to work for blob

My Azure Function has two input parameters: 我的Azure函数有两个输入参数:

  • Event Hubs trigger 事件中心触发
  • Blob input binding Blob输入绑定

I am trying to bind both parameters to custom type (F# record in my case). 我试图将两个参数都绑定到自定义类型(在我的情况下为F#记录)。 Binding works fine for the trigger, but not for blog binding, which gives the following error: 绑定对于触发器有效,但不适用于博客绑定,这会产生以下错误:

Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.MailboxFanOut'. 
Microsoft.Azure.WebJobs.Host: Can't bind Blob to type 'Run+CustomerName'.

Here is the code: 这是代码:

[<CLIMutable>]
type CustomerName = {
    UserName: string
}

let Run(item: CustomerName, userNames: CustomerName, log: TraceWriter) =
    log.Verbose("F# function executing")

Replacing F# record with a class doesn't help... 用类替换F#记录无济于事...

Here is the function definition: 这是函数定义:

{
  "bindings": [
    {
      "type": "eventHubTrigger",
      "name": "item",
      "direction": "in",
      "path": "blabla",
      "connection": "eventhubs",
      "consumerGroup": "$Default"
    },
    {
      "type": "blob",
      "name": "userNames",
      "path": "tada/123",
      "connection": "foo",
      "direction": "in"
    }
  ],
  "disabled": false
}

The blob bindings unfortunately don't currently support POCO bindings as you'd expect. 不幸的是,blob绑定当前不像您期望的那样支持POCO绑定。 We have an open issue in our repo tracking this here . 我们的回购中有一个未解决的问题,我们在此处进行跟踪。

To work around that, I recommend binding to a Stream, string, or one of the other supported types and doing the deserialization into your POCO type in your method. 要解决此问题,建议您绑定到Stream,字符串或其他受支持的类型之一,并在方法中将反序列化为POCO类型。

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

相关问题 azure 函数 - Blob 输入绑定 - azure function - Blob input binding Bing Web Search API v7似乎不起作用 - Bing Web Search API v7 doesn't seem to work Microsoft Graph OData查询参数$ expand似乎不起作用 - Microsoft Graph OData query parameter $expand doesn't seem to work ILotionBuilder在Appsettings中记录LogLevel在Azure日志流或Blob日志中似乎没有确认Json - ILoggingBuilder Logging LogLevel in Appsettings Json doesn't seem to be acknowledged in Azure Log Stream or Blob Log Azure 自定义视觉 SDK ImageRegionCreateEntry 似乎没有设置区域 - Azure Custom Vision SDK ImageRegionCreateEntry doesn't seem to set region 为什么 NLog 到 Azure blob 存储不起作用? - Why NLog to Azure blob storage doesn't work? 块 blob 服务:存在超时不起作用 - Block blob service: timeout on exists doesn't work Windows Azure blob上存储的视频不适用于VideoJS(对于Chrome) - Video stored on Windows Azure blob doesn't work with VideoJS (with Chrome) 具有 HTTP 触发器和 Blob 输入绑定的 Azure 函数 - 无法读取文件夹中的 JSON 文件。 可能的 blob 文件路径错误? - Azure Function with HTTP Trigger and Blob Input Binding - can't read JSON files that are in a folder. Possible blob file path error? Azure功能blob输入与servicebus触发器绑定 - Azure Function blob input binding with a servicebus trigger
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM