Search code examples
azure-functionsvisual-studio-2022azure-functions-core-tools

Running multiple Azure Functions locally


I have a solution in Visual Studio 2022 with multiple Azure Functions projects in it. The projects are in .NET 4.8 using the v1 of the function run-time.

When debugging locally I want all the function applications to run. I set them all as startup projects in my solution configuration. I had already found that I can change the default port for the function app by setting a command line argument in the debug launch profile, like so.

enter image description here

The issue is that they all want to bind to port 5858 for debugging. Additional research uncovered the --nodeDebugPort argument. I added that to the debug profile but when I run from Visual Studio by hitting F5 they all still want to use 5858. However, if I run them from the command-line using the following command they will honor the debug port setting.

..\..\..\node_modules\azure-functions-core-tools\bin\func host start --port 7072 --nodeDebugPort 5859

Any idea why the debug port argument is ignored when running from Visual Studio but honored when running from command line?


Solution

  • Any idea why the debug port argument is ignored when running from Visual Studio but honored when running from command line?

    As suggested by ahmelsayed,:

    Apart from using --nodeDebugPort from command line, you can define it in local.settings.json:

    {
       "NodeDebugPort": 5859
    }
    

    Other references: Two processes of func reusing the same configuration settings, How Can I run multiple Azure .net 5 Function Projects locally in Visual Studio 2019? and How to run Azure Function app on a different port in VS

    You can refer to nodeDebugPort related issues on GitHub or open a new issue for further clarification.