0.3 WebJobs SDK打破了我的参数绑定

时间:2014-06-25 22:27:33

标签: azure-storage azure-webjobs

我有以下方法定义:

public static void ProcessPackageRequestMessage(
    [QueueTrigger(queues.PACKAGE)] PackageRequestMessage message, 
    [Blob(blobs.PACKAGE + "/{RequestId}_{BlobFile}")] ICloudBlob blob,
    [Table(tables.PACKAGE)] CloudTable table,
    [Queue(queues.EMAIL)] out PackageEmailMessage packageEmailMessage)

PackageRequestMessage类定义如下:

public class PackageRequestMessage
{
    public Guid RequestId { get; set; }
    public Guid FactoryId { get; set; }
    public string BlobFile { get; set; }
    public string SKU { get; set; }
    public string EmailAddress { get; set; }
}

在SDK的0.2版本中,当PackageRequestMessage的JSON消息发布到队列时,调用此方法,并根据PackageRequestMessage(RequestId和BlobFile)中的参数找到相应的Blob,并且运作良好。

现在,在SDK的0.3版本中,我收到以下错误:

System.InvalidOperationException:System.InvalidOperationException:异常绑定参数' blob' ---> System.InvalidOperationException:name参数没有值' RequestId'  在Microsoft.Azure.Jobs.RouteParser.ApplyNamesWorker(String pattern,IDictionary 2 names, Boolean allowUnbound) at Microsoft.Azure.Jobs.RouteParser.ApplyBindingData(String pattern, IReadOnlyDictionary 2 bindingData)  在Microsoft.Azure.Jobs.Host.Blobs.Bindings.BlobBinding.Bind(BindingContext context)  在Microsoft.Azure.Jobs.Host.Runners.TriggerParametersProvider 1.Bind() --- End of inner exception stack trace --- at Microsoft.Azure.Jobs.Host.Runners.DelayedException.Throw() at Microsoft.Azure.Jobs.Host.Runners.WebSitesExecuteFunction.ExecuteWithSelfWatch(MethodInfo method, ParameterInfo[] parameterInfos, IReadOnlyDictionary 2个参数,TextWriter consoleOutput)  在Microsoft.Azure.Jobs.Host.Runners.WebSitesExecuteFunction.ExecuteWithOutputLogs(FunctionInvokeRequest request,IReadOnlyDictionary 2 parameters, TextWriter consoleOutput, CloudBlobDescriptor parameterLogger, IDictionary 2 parameterLogCollector)  在Microsoft.Azure.Jobs.Host.Runners.WebSitesExecuteFunction.ExecuteWithLogMessage(FunctionInvokeRequest请求,RuntimeBindingProviderContext上下文,FunctionStartedMessage消息,IDictionary`2参数LogCollector)  在Microsoft.Azure.Jobs.Host.Runners.WebSitesExecuteFunction.Execute(FunctionInvokeRequest request,RuntimeBindingProviderContext context)

在仪表板中,消息本身显示JSON中存在有效的RequestId,因此我不确定它为何报告丢失。

2 个答案:

答案 0 :(得分:0)

pianomanjh,我能够重现你描述的问题并且我提交了一个错误。似乎这种失败只发生在blob名称模式中,参数绑定不受影响。

现在的解决方法是使用string而不是Guid作为属性类型。

答案 1 :(得分:0)

刚刚找到了blob问题的解决方案我0.3.0。与版本0.2.0相比,您必须将Blob定义为FileAccess.Write以使其工作。它解决了我上面描述的问题,以便能够流式传输到blob