gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 23:17:12 26 4
gpt4 key购买 nike

我正在开发一个 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com