I am using Azure webjobs version 3.x for EventHub trigger. Provided the event hub connection string in the appSettings.json file by using the field "EventHubConnection". But when i tried to run the function, i am getting below error: Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: 'Error indexing method 'Functions.Trigger'' InvalidOperationException: No event hub receiver named
Program.cs
var builder = new HostBuilder();
builder.ConfigureWebJobs(b =>
{
b.AddEventHubs();
});
var host = builder.Build();
using (host)
{
host.Run();
}
Function.cs:
public static void Trigger([EventHubTrigger("my eventhub name")] EventData message, ILogger logger)
{
string data = Encoding.UTF8.GetString(message.Body);
logger.LogDebug(".....");
}
appsettings.json:
{
"ConnectionStrings": {
"EventHubConnection": "Endpoint=....."
}
}