简体   繁体   English

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

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

I am trying to develop an @AzureFunctions using Xamarin Forms. 我正在尝试使用Xamarin Forms开发@AzureFunctions。 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? 如何在Visual Studio 2017上配置Azure功能的主机,端口以启用来自*的连接而不是localhost连接?

How to accept connections from local network on Azure Functions (v2) ? 如何在Azure Functions(v2)上接受来自本地网络的连接?

How to configure Host : Port of Azure Functions on Visual Studio 2017 ? 如何在Visual Studio 2017上配置Host:Azure Functions端口?

I want that it accepts like ASP.Net Core (.UseUrls(" http://+:7071 ")): 我希望它接受类似ASP.Net Core(.UseUrls(“ http:// +:7071 ”))的代码:

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

but it is only listening on 但它只是在听

http://localhost:7071

Azure Functions主机

GitHub Issue: How to configure Azure Functions (v2) listening Host / Domain ? GitHub问题:如何配置Azure功能(v2)侦听主机/域? https://github.com/Azure/azure-functions-core-tools/issues/537 https://github.com/Azure/azure-functions-core-tools/issues/537

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 . 您可以通过指定配置端口func host的调试参数的命令,并使用-p开关,但主机名被硬编码到localhost ,因为可以在源代码中可以看出这里

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. GitHub上有一个要求此功能的开放问题: https : //github.com/Azure/azure-functions-core-tools/issues/174 ,所以如果这对您很重要并且您尚未这样做,请一定要注意。项目所有者已经在该线程上。

Also, since this is all open source, you do have the option of submitting a PR to add this functionality. 另外,由于这都是开源的,因此您可以选择提交PR来添加此功能。 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. 我绝对鼓励这样做,因为团队通常很难确定没有广泛应用或战略应用的场景(80%的情况),因此PR确实可以帮助解决20%用例的剩余长尾。

This was solved with the recent updates made on Azure Functions (v2). 这是通过对Azure Functions(v2)进行的最新更新解决的。
Now the Azure Functions listens on IP 0.0.0.0 现在,Azure函数在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. 因此,我们只需选择计算机IP地址(例如http://192.168.15.16:7071/api/Ping )并使用它,Azure Functions将按预期在LAN上响应。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM