Reputation: 165
I have tried this and I get the following error
Port 7071 is unavailable. Close the process using that port, or specify another port using --port [-p].
There are various fixes for this to run the second function on a different port which I think work on pre .net 5 but they do not work on .net 5
Any ideas please?
Upvotes: 1
Views: 3097
Reputation: 276
This is a bug in VS2019. Fixed for VS2022 preview, but not in VS2019 so far.
Upvotes: 0
Reputation: 952
Refer to this link Setting different port for azure function
How to start multiple projects in Visual Studio
Upvotes: 0
Reputation: 11
A rather trivial solution based on juunas' answer to the Run Azure Functions V3 (.NET 5) on a different port locally question that initially didn't work for me.
I was not able to start the function app on a port different from the default 7071 directly from Visual Studio 2019, but I managed to start it from the command prompt and then attach the debugger to the new dotnet.exe process.
Briefly:
dotnet func.dll host start
, so you can start your function app on the 7073 port with the command:
"%LOCALAPPDATA%\AzureFunctionsTools\Releases\3.28.0\cli_x64\func.dll" host start --port 7073
Obviously this is not an optimal solution because we are explicitly referring to a particular Functions version, but it's a pragmatic procedure to run and debug multiple Function projects locally.
Upvotes: 1