With previous versions of Azure Functions, I used to be able to use this line in Properties -> Debug -> Application Arguments
host start --port 7073 --pause-on-error
However, in Azure Functions V3, running .NET 5, it doesn't work.
I get the following message when I try to run it.
Could not execute because the specified command or file was not found. Possible reasons for this include:
- You misspelled a built-in dotnet command.
- You intended to execute a .NET program, but dotnet-host does not exist.
- You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Do I need to use a different command for .NET 5? Or put it in a completely different place?
First, create a new Azure Functions app in Visual Studio, add a breakpoint in the HTTP trigger, and then start debugging. The Azure Function app will launch in a local Functions host, and your trigger will be available locally on http://localhost:7071/api/Function1 (so listening on port 7071 ).
Your local functions can connect to live Azure services, and you can debug them on your local computer using the full Functions runtime.
As of March 2021, Microsoft announced that Azure Functions are supported running on . NET 5.
I did a little bit of digging with Task Manager and I can see that two dotnet processes run when you start the Function app from VS:
It seems the command has been changed to dotnet func.dll host start ...
that is run in the bin/Debug/net5.0 folder, instead of the previous func host start
.
We are able to change the port at least by setting the Application arguments to:
"%LOCALAPPDATA%\AzureFunctionsTools\Releases\3.23.5\cli_x64\func.dll" host start --port 7073 --pause-on-error
But now we are hard-coding the Functions version :\
I'm not sure if it's possible to get the Functions version/path from variables. If someone knows, do leave a comment :)
For .NET 6 preview with Visual Studio 2022, you can just pass in the following command if it runs as project instead of executable:
host start --port 11000
For executable project, I have not got it work easily without specifying the detailed paths. Build Azure Functions with .NET 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With