Сообщение об ошибке:
Код: Выделить всё
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ProcessEvent'. RabbitMQ.Client: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=404, text='NOT_FOUND - no queue 'test' in vhost '/''
Ниже файлы программы и файлы проекта (я использовал VS), а также полный вывод.
Используемые команды:
- Для запуска RabbitMQ: docker run -it --rm --name RabbitMQ -p 5672:5672 -p 15672:15672 RabbitMQ:4-management
- Изменить 1: Добавлена информация о том, что я запускаю RabbitMQ локально в Docker
- Изменить 2: Добавлена дополнительная информация о том, как я запускаю RabbitMQ локально
Код: Выделить всё
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;
namespace FunctionApp1;
public class Function1
{
private readonly ILogger _logger;
public Function1(ILogger logger)
{
_logger = logger;
}
[Function("ProcessEvent")]
public void Run(
[RabbitMQTrigger("test", ConnectionStringSetting = "RabbitMQConnection")] string message)
{
_logger.LogInformation($"RabbitMQ message received: {message}");
_logger.LogInformation("Message processing completed.");
}
}
Код: Выделить всё
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"RabbitMQConnection": "amqp://guest:guest@localhost:5672"
}
}
Код: Выделить всё
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
}
}
Код: Выделить всё
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = FunctionsApplication.CreateBuilder(args);
builder.ConfigureFunctionsWebApplication();
builder.Services
.AddApplicationInsightsTelemetryWorkerService()
.ConfigureFunctionsApplicationInsights();
builder.Build().Run();
Код: Выделить всё
net8.0
v4
Exe
enable
enable
Код: Выделить всё
'local.settings.json' found in root directory (C:\Users\user\source\repos\FunctionApp1\bin\Debug\net8.0).
Resolving worker runtime to 'dotnet-isolated'.
Azure Functions Core Tools
Core Tools Version: 4.5.0+e74aae22c9630777c9f58354f290a6e214218546 (64-bit)
Function Runtime Version: 4.1044.400.25520
[2025-11-26T09:56:59.113Z] Found C:\Users\user\source\repos\FunctionApp1\FunctionApp1.csproj. Using for user secrets file configuration.
[2025-11-26T09:57:01.068Z] Worker process started and initialized.
[2025-11-26T09:57:01.148Z] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ProcessEvent'. RabbitMQ.Client: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=404, text='NOT_FOUND - no queue 'test' in vhost '/'', classId=50, methodId=10.
[2025-11-26T09:57:01.166Z] Error indexing method 'Functions.ProcessEvent'
[2025-11-26T09:57:01.168Z] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ProcessEvent'. RabbitMQ.Client: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=404, text='NOT_FOUND - no queue 'test' in vhost '/'', classId=50, methodId=10.
[2025-11-26T09:57:01.172Z] Function 'Functions.ProcessEvent' failed indexing and will be disabled.
[2025-11-26T09:57:01.176Z] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[2025-11-26T09:57:01.190Z] The 'ProcessEvent' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ProcessEvent'. RabbitMQ.Client: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=404, text='NOT_FOUND - no queue 'test' in vhost '/'', classId=50, methodId=10.
Functions:
ProcessEvent: rabbitMQTrigger
For detailed output, run func with --verbose flag.
[2025-11-26T09:57:06.121Z] Host lock lease acquired by instance ID '000000000000000000000000A4E593EA'.
Подробнее здесь: https://stackoverflow.com/questions/798 ... -localhost
Мобильная версия