I have created a C# function in Azure using Visual Studio Code and followed the below steps to
- Select a language for your function project –> Choose C#.
- Select a .NET runtime — > Choose .NET 8.0 Isolated (LTS).
- Select a template for your project’s first function –> Choose HTTP trigger.1
- Provide a function name Type –> HttpExample.
- Provide a namespace Type –> My.Functions.
- Authorization level –> Choose Anonymous.
- open your project –>Select Open in current window.
after this steps i build and tried to run the app locally,
I got error:
dotnet run
Unhandled exception. System.InvalidOperationException: The gRPC channel URI 'http://:' could not be parsed.
at Microsoft.Extensions.DependencyInjection.GrpcServiceCollectionExtensions.GetFunctionsHostGrpcUri(IConfiguration configuration) in D:a_work1ssrcDotNetWorker.GrpcGrpcServiceCollectionExtensions.cs:line 97
how to resolve this issue?
I have tried same steps for .NET 6.0 Isolated (LTS). version its working and running perfectly fine.
I have also updated and install relevant required tools and package updates for .net version 8 but still facing the error.
2
Answers
Here below some steps tried to resolve the given issue.. initially I have followed the steps for setup using (https://learn.microsoft.com/en-us/azure/azure-functions/functions-develop-vs-code?tabs=node-v4%2Cpython-v2%2Cisolated-process&pivots=programming-language-csharp )
then also did some updates for make it run as below : -
4.0.5700) and (Function Runtime Version: 4.33.2.22572)
enter image description here
I see you are trying to run an Azure isolated function using
dotnet run
command but you need to usefunc host start
orfunc start
command to run an Azure function.I have created a default .Net8 isolated function using the template in visual studio code and my function code looks like below-
In order to run the function either navigate to Run -> Start Debugging or Run without Debugging in visual studio code. You can also execute your function using func host start or func start command in terminal as shown below-