azure-functions - Azure 函数 2.0 : How to start a project from command prompt and allow connection from other machines?

标签 azure-functions

我正在开发一个 Azure Functions 2 项目,当使用 Visual Studio 2017 并运行时,它的工作方式如下:
dotnet Azure Functions

1) 启动 Azure Function Project DLL 的命令行和正确参数是什么?
如何通过命令提示符(在 Visual Studio 之外)运行相同的命令?

2) 如何接受来自其他机器的连接,而不仅仅是本地主机?
我希望它像 ASP.Net Core (.UseUrls("http://+:7071 ")) 一样接受:

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

但它只是在听
http://localhost:7071

我是 Azure 的粉丝,但我问这个是因为我想将开发版本放在本地服务器上(前提是),稍后当应用程序增长时我计划发布到 Azure;但现在我不想在此服务器上安装 SQL Server 来运行 Azure Functions 门户(Azure Functions Runtime)...

我不想安装 Azure Functions 门户。我只想启动项目,就像 Visual Studio 2017 一样,使用 IP 地址或计算机名称接受来自其他计算机的连接。

最佳答案

我现在测试了新版本,它可以按预期工作!
现在,我可以轻松地在桌面上运行 Azure Functions 并在本地网络上的另一台设备上调用 API,也可以从我的手机上调用。

我更新到 Visual Studio 2019,工具更新为:

Azure Functions Core Tools (2.6.1080 Commit hash: 509d59b7eb6fbfb89f70ce96ad22e00f8f7bafdd)
Function Runtime Version: 2.0.12427.0

现在在控制台上出现:
Now listening on: http://0.0.0.0:7071

Screenshot

要从 Visual Studio 外部的命令行运行该函数,我做了:

安装/更新工具:
npm install azure-functions-core-tools -g

启动 Azure Functions 主机:
func host start

(我用的是 npm 5.6.0,它是用 nodejs 安装的)

关于azure-functions - Azure 函数 2.0 : How to start a project from command prompt and allow connection from other machines?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48347387/

相关文章:

azure - 使用运行时 4、.NET 6 在进程外运行 Azure 函数时遇到问题

azure - 无法从 Azure Function 连接到 Azure Cosmos DB。获取“Microsoft.Azure.Cosmos.Direct : Object reference not set to an instance of an object

azure - 当有多个函数时,是否可以在 Azure 函数应用程序中只部署一个函数?

c# - Console.WriteLine有时会抛出句柄无效异常

azure-functions - 如何从 Azure 函数输出多个 blob?

azure - AWS Lambda 的 Azure 等价物是什么?

python - 在 Azure Functions 中安装 snowflake-connector-python[pandas]

python - 使用 python Azure SDK 删除和创建 Azure VPN 网关

azure - 如何识别 Azure Cosmos DB 触发器中的 "insert"与 "update"diff?

javascript - azure函数http触发输入cosmos db文档