CloudQueueMessage(byte[])
コンストラクタを使用してメッセージを投稿するストレージキューがあります。私は、次のシグネチャでwebjob機能でメッセージを処理しようとした:Azure WebJobs QueueTriggerは、メッセージのbyte []本文を文字列に変換しようとします。
public static void ConsolidateDomainAuditItem([QueueTrigger("foo")] CloudQueueMessage msg)
私は例外
UserTypeArgumentBindingProvider.BindAsync
のコードを見てみると
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Program.ConsolidateDomainAuditItem ---> System.InvalidOperationException: Exception binding parameter 'msg' ---> System.Text.DecoderFallbackException: Unable to translate bytes [FF] at index -1 from specified code page to Unicode.
at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)
at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes)
at System.Text.UTF8Encoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder)
at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding)
at System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)
at Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage.get_AsString()
at Microsoft.Azure.WebJobs.Host.Storage.Queue.StorageQueueMessage.get_AsString()
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()
と一致失敗を取得し、それが明確に渡されることを期待し本文がJSONオブジェクトのメッセージです。また、名前のUserType...
は、POCOをバインドすることを想定しています。
しかし、MSDNの記事How to use Azure queue storage with the WebJobs SDKは明らかにあなたは、次のタイプでQueueTriggerを使用することができます
と述べている:
string
- JSON
byte[]
- としてシリアライズA POCOタイプ
CloudQueueMessage
なぜ私のメッセージにバインドされていませんか?
パラメータの名前はバインディングロジックをまったく考慮しません。必要な名前を付けることができます。おそらく、あなたの機能を働かせるために何か他の変化が起こったでしょうか?それはパラメータ名にすることはできません:) – mathewc