Skip to content

Commit b16f0c7

Browse files
committed
Fixing IHostIdProvider registration
1 parent 5eb137d commit b16f0c7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/WebJobs.Script.WebHost/WebScriptHostBuilderExtension.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using Microsoft.Azure.WebJobs.Host.Config;
6+
using Microsoft.Azure.WebJobs.Host.Executors;
67
using Microsoft.Azure.WebJobs.Host.Timers;
78
using Microsoft.Azure.WebJobs.Script.Diagnostics;
89
using Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection;
@@ -55,6 +56,9 @@ public static IHostBuilder AddWebScriptHost(this IHostBuilder builder, IServiceP
5556
services.TryAddSingleton<IScriptWebHookProvider>(p => p.GetService<DefaultScriptWebHookProvider>());
5657
services.TryAddSingleton<IWebHookProvider>(p => p.GetService<DefaultScriptWebHookProvider>());
5758

59+
// Make sure the registered IHostIdProvider is used
60+
services.AddSingleton<IHostIdProvider>(rootServiceProvider.GetRequiredService<IHostIdProvider>());
61+
5862
// Logging and diagnostics
5963
services.AddSingleton<IMetricsLogger, WebHostMetricsLogger>();
6064
services.AddSingleton<IAsyncCollector<Host.Loggers.FunctionInstanceLogEntry>, FunctionInstanceLogger>();

0 commit comments

Comments
 (0)