我们使用 Azure 队列进行打印作业,但是当通过 queue.DeleteMessage(message) 从队列中删除消息时,该方法会引发以下异常。
远程服务器返回错误:(404) 未找到
上述异常已处理,但仍在寻找解决方法。
任何人都可以建议如何修复它。
谢谢, 斯内赫
最佳答案
根据this article ,我们可以发现:
After a client retrieves a message with the Get Messages operation, the client is expected to process and delete the message. To delete the message, you must have two items of data returned in the response body of the Get Messages operation:
- The message ID, an opaque GUID value that identifies the message in the queue.
- A valid pop receipt, an opaque value that indicates that the message has been retrieved.
如果未找到具有匹配弹出收据的消息,服务将返回错误代码 404(未找到)。并且 Pop 收据保持有效,直到发生以下事件之一:
- The message has expired.
- The message has been deleted using the last pop receipt received either from
Get Messages
orUpdate Message
.- The invisibility timeout has elapsed and the message has been dequeued by a
Get Messages
request. When the invisibility timeout elapses, the message becomes visible again. If it is retrieved by anotherGet Messages
request, the returned pop receipt can be used to delete or update the message.- The message has been updated with a new visibility timeout. When the message is updated, a new pop receipt will be returned.
关于azure - 远程服务器返回错误: (404) Not Found While deleting message from queue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45097796/