通过REST API向Azure服务总线队列发送消息时出现405错误

时间:2019-10-01 03:54:06

标签: azureservicebus azure-servicebus-queues

我试图通过RESTMAN使用REST API将消息发送到Azure ServiceBus队列,但是当我触发消息时,出现以下错误:

<Code>405</Code>

<Detail>The SessionId was not set on a message, and it cannot be sent to the entity. Entities that have session support enabled can only receive messages that have the SessionId set to a valid value. TrackingId:aew3fd4-9721d-455456-df56-453345, SystemTracker:SampleNamespace:Queue:queue_name, Timestamp:2019-09-30T10:27:09</Detail>

enter image description here 有人可以告诉我如何在标题标签中添加sessionId以及如何设置吗?我尝试了几件事,但是没有用。

谢谢, 鲁德拉(Rudra)

1 个答案:

答案 0 :(得分:0)

必须在broker_properties标头中定义sessionId

BrokerProperties:  { “SessionId”: “{Your session ID}”, “MessageId”: “{701332E1-B37B-4D29-AA0A-E367906C206E}”, “TimeToLive” : 90, “CorrelationId”: “{701332F3-B37B-4D29-AA0A-E367906C206E}”, “SequenceNumber“ : 12345, “DeliveryCount“ : 2, “To“ : "http://contoso.com“, “ReplyTo“ : "http://fabrikam.com“,  "EnqueuedTimeUtc“ : " Sun, 06 Nov 1994 08:49:37 GMT“, "ScheduledEnqueueTimeUtc“ : " Sun, 06 Nov 1994 08:49:37 GMT“}

you can find more details from here