I am setting local host port in local.setting.json. Referring Microsoft doc https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local
The file looks
I used the accepted answer but I still got an error when the debugger port was trying to bind because both function apps were trying to bind to 5858.
To get around that I added one more attribute to the application arguments in the project settings and my arguments look like this:
host start --pause-on-error --nodeDebugPort 5860
Update Project Properties -> Debug to following
host start --port 7073 --pause-on-error
Update: If you're just looking to change the port, you don't have to set it through the file specified in the question. Check Thuc Nguyen answer
Original answer:
the command line takes precedence over the settings file, the problem is that VS passes an explicit port on the command line.
work around is to go through project -> properties -> Debug
, then under Application arguments
take control of the args. you can type host start --pause-on-error
Edit from ravinsp:
Update for .Net Core 2.0 function project:
The command line arguments you have to pass are different. You have to pass in the path to a dll in front. Like this:
%AppData%\..\Local\Azure.Functions.V2.Cli\2.0.1-beta.22\Azure.Functions.Cli.dll host start --pause-on-error
You can see for yourself by running the function in Visual Studio and using the process explorer to see command line args to dotnet.exe process.
edit: a word
To do this
Select the Function App Project in Visual Studio -> Hit Alt+Enter
and navigate to Debug settings and set
host start --port 8085 --nodeDebugPort 6890
If you're using Visual Studio for MacOS right click on your project, click Options, click on Run -> Configurations -> Default
and enter host start --port 7073 --pause-on-error
in the Arguments field.
I am using the CLI version 1.2.1, and the following Application arguments
setting in Project Properties -> Debug
worked for me.
host start --port 7074 --nodeDebugPort 5860