我的项目是一个UWP应用程序。我遵循这个链接的指导方针。网址:https://github.com/Azure/azure-service-bus/tree/master/samples/DotNet/Microsoft.Azure.ServiceBus/BasicSessionSendReceiveUsingQueueClient。然后我遇到了问题。当我打电话给' session.CompleteAsync'时,消息无法完成。消息仍然在队列中,直到它超出其最大传递计数。
private async Task ProcessSessionMessagesAsync(IMessageSession session, Message message, CancellationToken token)
{
var sessionId = session.SessionId;
var sequenceNumber = message.SystemProperties.SequenceNumber;
var messageId = message.MessageId;
var messageBody = Encoding.UTF8.GetString(message.Body);
await session.CompleteAsync(message.SystemProperties.LockToken);
}