Таким образом, у меня есть веб-задание Azure, связанное с CloudQueue
через механизм ProcessQueueMessage
пакета SDK WebJobs с использованием типа параметра CloudQueueMessage
. Это дает мне FunctionInvocationException
при запуске через QueueTrigger
.
Подробно
Элемент успешно добавлен в CloudQueue
с помощью метода AddMessageAsync
:
await queue.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(myObject)));
И отображается в очереди как ожидаемое JSON-представление моего объекта (из предварительного просмотра текста сообщения в Cloud Explorer):
{"EmailAddress":"[email protected]",
"Subject":"Test",
"TemplateId":"00-00-00-00-00",
"Model":{"PropertyName1":"Test1","PropertyName2":"Test2"}
}
Однако при срабатывании метода ProcessQueueMessage
:
public static async void ProcessQueueMessage(
[QueueTrigger(queueName)] CloudQueueMessage message, TextWriter log)
... Я получаю FunctionInvocationException
:
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.ProcessQueueMessage ---> System.InvalidOperationException: Exception binding parameter 'message' ---> System.ArgumentNullException: String reference not set to an instance of a String.
Parameter name: s
at System.Text.Encoding.GetBytes(String s)
at Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage.get_AsBytes() in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\Common\Queue\CloudQueueMessage.Common.cs:line 146
at Microsoft.Azure.WebJobs.Host.PropertyHelper.CallPropertyGetter[TDeclaringType,TValue](Func`2 getter, Object this)
at Microsoft.Azure.WebJobs.Host.PropertyHelper.GetValue(Object instance)
at Microsoft.Azure.WebJobs.Host.Bindings.BindingDataProvider.GetBindingData(Object value)
at Microsoft.Azure.WebJobs.Host.Queues.Triggers.UserTypeArgumentBindingProvider.UserTypeArgumentBinding.BindAsync(IStorageQueueMessage value, ValueBindingContext context)
at Microsoft.Azure.WebJobs.Host.Queues.Triggers.QueueTriggerBinding.<BindAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.<BindCoreAsync>d__7.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Azure.WebJobs.Host.Executors.DelayedException.Throw()
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithWatchersAsync>d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown
Похоже, это наводит на мысль, что параметр message
не может прочитать JSON в объекте CloudQueueMessage
... но не похоже, что это то, что я контролирую.
Есть ли у кого-нибудь предложения относительно того, почему это может происходить?
Информация о версии
Microsoft.Azure.Webjobs 1.1.1
WindowsAzure.Storage 6.2.2-предварительная версия
DNX 4.5.1
Фон