我正在使用代码片段将消息发送到服务总线主题.
try
{
// sb is instance of ServiceBusConfig.GetServiceBusForChannel
await sb.SendAsync(message);
}
catch (Exception ex)
{
this.logger.LogError(
"chanel",
"An error occurred while sending a notification: " + ex.Message,
ex);
throw;
}
Run Code Online (Sandbox Code Playgroud)
和实施是
public async Task SendAsync(BrokeredMessage message)
{
if (this.topicClient == null)
{
this.topicClient = TopicClient.CreateFromConnectionString(this.primaryConnectionString, this.topicPath);
this.topicClient.RetryPolicy = this.retryPolicy;
}
await this.topicClient.SendAsync(message);
}
Run Code Online (Sandbox Code Playgroud)
错误:-
"ErrorCode,12005,Message,""发送通知时发生错误:操作未在分配的超时00:01:00内完成.分配给此操作的时间可能是较长超时的一部分. .在异常类型和适当的异常处理,异常"" Microsoft.ServiceBus.Messaging.MessagingException更多信息:该操作没有的00:01:00在规定的超时时间内完成分配给此操作的时间可能是一部分更长的超时.
有关异常类型和正确异常处理的更多信息
c# azure azureservicebus asp.net-web-api azure-servicebus-topics