Azure Functions Dotnet Isolated Run On Different Port
This is specific to Azure Functions Dotnet Isolated mode but it is applicable to normal function as well.
Normally when there is only single function app, then there is no problem with default port settings of 7071. As no of function apps grow and required some integration between them, at that point it is required to run multiple function app and so different port settings required.
There is one settings in local.settings.json for "LocalHttpPort" but it is not working at the time of writing this article. There is bug registered so wait till it get resolved. By that time following settings can be useful.
Environment
Visual Studio 2022
.NET 6
Azure Functions v4
Command line
There are two solution
Pre-requisite
Install Azure Functions Core Tools. Download Location
Solution 1
This one is simple but required to run from command line.
Open the terminal and probably in Admin mode if there is some firewall settings.
Go to location at function app located. For example in my case it is located at
Then run following command. func start --port <>
It will run function app on 7073 port.
Solution 2
In this solution we try to integrate in Visual Studio. Please take a note that, visual studio version in VS 2022.
Go to Properties of Project.
Then go to Debug -> General.
Click on Open Debug Launch Profiles UI
In that Add new profile of type of "Executable" and following settings.
Executable : func
Command line arguments: start --port 7074
Once done go to profile selection while project.
Solution 3
This is also related to Visual Studio 2022.
In project structure , look for properties directory.
That directory normally contains two files serviceDependencies.json and serviceDependencies.local.json.
Add or update file launch settings.json. It will look something like this.
{
"profiles": {
"FunctionAppPort": {
"commandName": "Project"
},
"Port 7074 Configuration": {
"commandName": "Executable",
"executablePath": "func",
"commandLineArgs": "start --port 7074"
}
}
}
- Now same as Solution 2. Select specific profile to run.
Hope this helps.
Update 25-04-2022
As per the recent changes, Now it is respecting the configuration in local.settings.json which is not working earlier for isolated mode.
In local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
},
"Host": {
"LocalHttpPort": 7073
}
}