Код: Выделить всё
NoAuthenticationInformation
Кто-нибудь знает, что может быть ошибаетесь?
Код:
Код: Выделить всё
builder.Services.AddScoped(provider =>
{
string queueName = builder.Configuration["IAQueue:QueueName"]
?? throw new InvalidOperationException("Queue name for IAQueue is not configured.");
string accountName = builder.Configuration["IAQueue:AccountName"]
?? throw new InvalidOperationException("Account name for IAQueue is not configured.");
if (builder.Environment.IsDevelopment())
{
string accountKey = builder.Configuration["IAQueue:AccountKey"]
?? throw new InvalidOperationException("Account key for IAQueue is not configured.");
string connectionString = $"DefaultEndpointsProtocol=https;AccountName={accountName};AccountKey={accountKey};EndpointSuffix=core.windows.net";
return new MessageQueueService(connectionString, queueName);
}
else
{
var queueUri = new Uri($"https://{accountName}.queue.core.windows.net/{queueName}");
QueueClient queueClient = new QueueClient(queueUri, new DefaultAzureCredential());
return new MessageQueueService(queueUri);
}
});
Подробнее здесь: https://stackoverflow.com/questions/793 ... tity-fails