First off, I have looked at the other SO posts with the same error message and none seem to resolve my issue. I have tried many permutations and options. My function builds fine but will not run in the CLI, I get the following cryptic error. The MSFT documentation does not seem to have the answers either.
No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
I am trying to run a timer job and then write a collection of messages to an event hub. What am I missing? I have been fighting this for hours.
Function:
[FunctionName("CreateData")]
public static async Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
[EventHub("murraytest", Connection = "evingest")] IAsyncCollector<string> myeventhub,
TraceWriter log)
{
await myeventhub.AddAsync("data1");
await myeventhub.AddAsync("data2");
await myeventhub.AddAsync("data3");
log.Info($"COMPLETED: {DateTime.Now}");
}
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"Eventhub": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "",
"evingest": "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=LtcqBLT5VWjg0dGMdIvxCcEGs8902010Y6y14iGg="
}
}
Packages
function.json - is missing any eventhub bindings!
{
"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.0.0",
"configurationSource": "attributes",
"bindings": [
{
"type": "timerTrigger",
"schedule": "0 */5 * * * *",
"useMonitor": true,
"runOnStartup": false,
"name": "myTimer"
}
],
"disabled": false,
"scriptFile": "..\bin\AzFuncs.dll",
"entryPoint": "AzFuncs.Function1.Run"
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…