diff --git a/host/src/FunctionsNetHost/Environment/EnvironmentVariables.cs b/host/src/FunctionsNetHost/Environment/EnvironmentVariables.cs index 4a2b5a401..362bdd9e9 100644 --- a/host/src/FunctionsNetHost/Environment/EnvironmentVariables.cs +++ b/host/src/FunctionsNetHost/Environment/EnvironmentVariables.cs @@ -14,4 +14,9 @@ internal static class EnvironmentVariables /// Application pool Id for the placeholder app. Only available in Windows(when running in IIS). /// internal const string AppPoolId = "APP_POOL_ID"; + + /// + /// Environment variable for sending ServerUri to the worker. + /// + internal const string HostEndpoint = "Functions:Worker:HostEndpoint"; } diff --git a/host/src/FunctionsNetHost/Grpc/GrpcClient.cs b/host/src/FunctionsNetHost/Grpc/GrpcClient.cs index c910c645f..d385f1c45 100644 --- a/host/src/FunctionsNetHost/Grpc/GrpcClient.cs +++ b/host/src/FunctionsNetHost/Grpc/GrpcClient.cs @@ -28,7 +28,7 @@ internal GrpcClient(GrpcWorkerStartupOptions grpcWorkerStartupOptions, AppLoader _outgoingMessageChannel = Channel.CreateUnbounded(channelOptions); - _messageHandler = new IncomingGrpcMessageHandler(appLoader); + _messageHandler = new IncomingGrpcMessageHandler(appLoader, _grpcWorkerStartupOptions); } internal async Task InitAsync() diff --git a/host/src/FunctionsNetHost/Grpc/IncomingGrpcMessageHandler.cs b/host/src/FunctionsNetHost/Grpc/IncomingGrpcMessageHandler.cs index 5380d71f3..8878780ed 100644 --- a/host/src/FunctionsNetHost/Grpc/IncomingGrpcMessageHandler.cs +++ b/host/src/FunctionsNetHost/Grpc/IncomingGrpcMessageHandler.cs @@ -10,10 +10,12 @@ internal sealed class IncomingGrpcMessageHandler { private bool _specializationDone; private readonly AppLoader _appLoader; + private readonly GrpcWorkerStartupOptions _grpcWorkerStartupOptions; - internal IncomingGrpcMessageHandler(AppLoader appLoader) + internal IncomingGrpcMessageHandler(AppLoader appLoader, GrpcWorkerStartupOptions grpcWorkerStartupOptions) { _appLoader = appLoader; + _grpcWorkerStartupOptions = grpcWorkerStartupOptions; } internal Task ProcessMessageAsync(StreamingMessage message) @@ -78,6 +80,8 @@ private async Task Process(StreamingMessage msg) EnvironmentUtils.SetValue(kv.Key, kv.Value); } + EnvironmentUtils.SetValue(EnvironmentVariables.HostEndpoint, _grpcWorkerStartupOptions.ServerUri.ToString()); + #pragma warning disable CS4014 Task.Run(() => #pragma warning restore CS4014 diff --git a/host/tools/build/Microsoft.Azure.Functions.DotnetIsolatedNativeHost.nuspec b/host/tools/build/Microsoft.Azure.Functions.DotnetIsolatedNativeHost.nuspec index 3626bb47a..1b77dda92 100644 --- a/host/tools/build/Microsoft.Azure.Functions.DotnetIsolatedNativeHost.nuspec +++ b/host/tools/build/Microsoft.Azure.Functions.DotnetIsolatedNativeHost.nuspec @@ -4,7 +4,7 @@ Microsoft.Azure.Functions.DotNetIsolatedNativeHost Microsoft Azure Functions dotnet-isolated native host dotnet-isolated azure-functions azure - 1.0.4 + 1.0.5 Microsoft Microsoft https://github.com/Azure/azure-functions-dotnet-worker