Reputation: 18175
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.
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?
Upvotes: 0
Views: 1639
Reputation: 141
I have several Azure Functions in my solution and I configure them using local.settings.json
(per function) by setting the LocalHttpPort
like below:
{
"IsEncrypted": false,
"Values": {
...
},
"Host": {
"LocalHttpPort": 7073
}
}
And then configure the solution in VS as "Multiple startup pojects" and choose those funcntion apps you wanna run parallel.
Upvotes: 0
Reputation: 1864
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.
Upvotes: 1