I am migrating an old solution containing projects versioned 2.1, 2.2, and 3.1 to 6.0. I’ve used Upgrade Assistant in VS to perform the migration and fixed all remaining build errors manually. 2 projects are azure function apps and with the upgrade (version was changed to v4).
The build works fine, but I am getting the below error when I run a function app in my local:
Message=The gRPC channel URI ‘http://:0’ could not be parsed.
Source=Microsoft.Azure.Functions.Worker.Grpc
StackTrace:
at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient.CreateClient()
at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.GrpcWorkerClient..ctor(GrpcHostChannel outputChannel, GrpcWorkerStartupOptions startupOptions, IMessageProcessor processor)
at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory.CreateClient(IMessageProcessor messageProcessor)
at Microsoft.Azure.Functions.Worker.GrpcWorker.StartAsync(CancellationToken token)
at Microsoft.Azure.Functions.Worker.WorkerHostedService.d__3.MoveNext()
at Microsoft.Extensions.Hosting.Internal.Host.d__9.MoveNext()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.d__4.MoveNext()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.d__4.MoveNext()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Program.$(String[] args) in some-folder-path-\Program.cs:line 7
I had a look at this link, but couldn’t resolve my issue.
Before the upgrade, the project didn’t have a Program.cs. The Upgrade Assistant created one and below are the contents:
using Microsoft.Extensions.Hosting;
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.Build();
host.Run();