We have an Azure WebJob (3.x) running under an API App in Azure, all Core 2.1. It publishes fine, and runs, but doesn't show any Functions or list the Function Invocations on the dashboard. Which is odd, because the console output for the job does show it detecting a function:
[10/17/2018 09:26:19 > fa7c81: SYS INFO] Run script 'run.cmd' with script host - 'WindowsScriptHost'
[10/17/2018 09:26:19 > fa7c81: SYS INFO] Status changed to Running
[10/17/2018 09:26:19 > fa7c81: INFO]
[10/17/2018 09:26:19 > fa7c81: INFO] D:\local\Temp\jobs\continuous\SubmissionJob\43ucb4rv.ipc>dotnet SubmissionJob.dll
[10/17/2018 09:26:21 > fa7c81: INFO] dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
[10/17/2018 09:26:21 > fa7c81: INFO] Hosting starting
[10/17/2018 09:26:21 > fa7c81: INFO] info: Microsoft.Azure.WebJobs.Hosting.JobHostService[0]
[10/17/2018 09:26:21 > fa7c81: INFO] Starting JobHost
[10/17/2018 09:26:21 > fa7c81: INFO] info: Host.Startup[0]
[10/17/2018 09:26:21 > fa7c81: INFO] Found the following functions:
[10/17/2018 09:26:21 > fa7c81: INFO] SubmissionJob.Functions.ProcessQueueMessageAsync
[10/17/2018 09:26:21 > fa7c81: INFO]
[10/17/2018 09:26:21 > fa7c81: INFO] Application started. Press Ctrl+C to shut down.
[10/17/2018 09:26:21 > fa7c81: INFO] Hosting environment: QA
The Program.cs Program
class looks like this:
public static async Task Main(string[] args)
{
var builder = new HostBuilder()
.UseEnvironment(Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"))
.ConfigureWebJobs(b =>
{
b.AddAzureStorageCoreServices()
.AddAzureStorage()
.AddServiceBus()
.AddEventHubs();
})
.ConfigureAppConfiguration(b =>
{
// Adding command line as a configuration source
b.AddCommandLine(args);
})
.ConfigureLogging((context, b) =>
{
b.SetMinimumLevel(LogLevel.Debug);
b.AddConsole();
// If this key exists in any config, use it to enable App Insights
var appInsightsKey = context.Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"];
if (!string.IsNullOrEmpty(appInsightsKey))
{
b.AddApplicationInsights(o => o.InstrumentationKey = appInsightsKey);
}
})
.ConfigureServices((context, services) =>
{
services.AddAutoMapper();
services.AddMemoryCache();
services.AddDbContext<SubmissionsDbContext>(opts =>
opts.UseSqlServer(context.Configuration.GetConnectionString("DefaultConnection")));
// cloud services
services.AddTransient(s =>
CloudStorageAccount.Parse(
context.Configuration.GetConnectionString("AzureQueueConnectionString")));
services.AddTransient<IBlobReadService, AzureBlobReadService>();
services.AddSingleton<IBlobWriteService, AzureBlobWriteService>();
services.AddSingleton<IQueueWriteService, AzureQueueWriteService>();
// submission services
services.AddScoped<ISubmissionStatusService, SubmissionStatusService>();
services.AddSingleton<Functions, Functions>();
// job activator, required in webjobs sdk 3+
services.AddSingleton<IJobActivator>(new WebJobsActivator(services.BuildServiceProvider()));
})
.UseConsoleLifetime();;
var host = builder.Build();
using (host)
{
await host.RunAsync();
}
}
The Functions.cs has a method with the following signature:
public async Task ProcessQueueMessageAsync([QueueTrigger("operations")] CloudQueueMessage incomingMessage, TextWriter log)
...scm.azurewebsites.net/azurejobs/#/jobs/continuous/SubmissionJob shows
Continuous WebJob Details SubmissionJob
Running
Run command: run.cmd
But there's no list of function invocations below it, and the job remains permanently in a Running
state. If I go to the 'Functions' link in Kudu, it says there are no functions/function invocations to display.
Any thoughts?
The bulk of this worked fine in Framework 4.7, though the app builder was clearly different.