Tony
Tony

Reputation: 17637

How to accept connections from local network on Azure Functions (v2)?

I am trying to develop an @AzureFunctions using Xamarin Forms. But it is not accepting connections from the cell phone.

How to configure host, port of Azure Functions on Visual Studio 2017 to enable connections from * other than localhost connections?

How to accept connections from local network on Azure Functions (v2) ?

How to configure Host : Port of Azure Functions on Visual Studio 2017 ?

I want that it accepts like ASP.Net Core (.UseUrls("http://+:7071")):

Now listening on: http://[::]:7071

but it is only listening on

http://localhost:7071

Azure Functions host

GitHub Issue: How to configure Azure Functions (v2) listening Host / Domain ? https://github.com/Azure/azure-functions-core-tools/issues/537

Upvotes: 6

Views: 3233

Answers (2)

Tony
Tony

Reputation: 17637

This was solved with the recent updates made on Azure Functions (v2).
Now the Azure Functions listens on IP 0.0.0.0

Hosting environment: Production
Content root path: C:\Users\tonyv\source\repos\SistemaMulti\WebAPI\bin\Debug\netstandard2.0
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.

So we can just pick the computer IP address, for example http://192.168.15.16:7071/api/Ping, and use it and Azure Functions will respond on the LAN, as expected.

See https://github.com/Azure/azure-functions-core-tools/issues/537#issuecomment-399239887

Upvotes: 2

Chris Gillum
Chris Gillum

Reputation: 15042

You can configure the port by specifying the func host command in the debug arguments and using the -p switch, but the hostname is hardcoded to localhost, as can be seen in the source code here.

There is an open issue on GitHub requesting this feature: https://github.com/Azure/azure-functions-core-tools/issues/174, so if this is important for you and you haven't done so already, be sure to chime in. The project owner is already on that thread.

Also, since this is all open source, you do have the option of submitting a PR to add this functionality. I definitely encourage this because the team often has a difficult time prioritizing scenarios that don't have broad or strategic application (the 80% cases), so PRs can be really helpful for rounding out the remaining long-tail of 20% use-cases.

Upvotes: 1

Related Questions