Run Azure Function on a different port

Azure Functions on PureSourceCode.com

I want to run more than one Azure Function at the same time but each of them on a different port because by default all Azure Functions are starting on port 7071. How can I do that?

Following the Microsoft documentation, I am setting local host port in local.setting.json. The file looks like below:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": ""   
  },
  "Host": {
    "LocalHttpPort": 7073
  }
}

When I run/debug the solution, Visual Studio still host the application on default port (7071).

I have checked the bin directory, the local.setting.json file is getting there with above settings. Running Azure Function CLI (func host start) from bin directory correctly read the port number.

I googled a bit and I discovered is in Visual Studio and how it works. The command line takes precedence over the settings file, the problem is that Visual Studio passes an explicit port on the command line.

Then, I have to override this configuration in same way. I think I can play with the property of a project. There are some parameters or arguments I can add or change.

The work around is to go through Project -> Properties -> Debug, then under Application arguments take control of the arguments. You can type 

host start --port 8085 --pause-on-error
Application arguments in the project property
Application arguments in the project property

If you are interested in more posts about Azure Functions, follow this link.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.