如何在 Azure Functions (v2) 上接受来自本地网络的连接?

Ton*_*ony 5 azure azure-functions visual-studio-2017

我正在尝试使用 Xamarin Forms 开发 @AzureFunctions。但它不接受来自手机的连接。

如何在 Visual Studio 2017 上配置 Azure Functions 的主机、端口以启用来自 * 本地主机连接以外的连接?

如何在 Azure Functions (v2) 上接受来自本地网络的连接?

如何在 Visual Studio 2017 上配置主机:Azure 函数的端口?

我希望它像 ASP.Net Core (.UseUrls(" http://+:7071 ")) 一样接受:

Now listening on: http://[::]:7071
Run Code Online (Sandbox Code Playgroud)

但它只是在听

http://localhost:7071
Run Code Online (Sandbox Code Playgroud)

Azure Functions 主机

GitHub 问题:如何配置 Azure Functions (v2) 侦听主机/域? https://github.com/Azure/azure-functions-core-tools/issues/537

Ton*_*ony 2

Azure Functions (v2) 的最新更新已解决此问题。
现在,Azure Functions 侦听 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.
Run Code Online (Sandbox Code Playgroud)

因此,我们只需选择计算机 IP 地址,例如http://192.168.15.16:7071/api/Ping,并使用它,Azure Functions 将按预期在 LAN 上响应。

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