我想经常检查azure servicebus / iothub的消息。但是,当我这样做时,我收到以下错误
"类型' Amqp.AmqpException'的例外情况发生在mscorlib.dll但未在用户代码中处理 附加信息:操作'接收'在州:结束时无效。"
我应该如何实现不断提取消息和/或解决此错误?
var connection = new Connection(address);
var session = new Session(connection);
var entity = Fx.Format("/devices/{0}/messages/deviceBound", _deviceId);
var receiveLink = new ReceiverLink(session, "receive-link", entity);
while (true)
{
await Task.Delay(1000);
var message = await receiveLink.ReceiveAsync();
if (message == null) continue;
//else do things with message
}