【问题标题】:Running Azure function as Windows Service for Debug purposes将 Azure 函数作为 Windows 服务运行以进行调试
【发布时间】:2020-09-28 04:05:24
【问题描述】:

我编写了一个 Azure(带有 http 触发方法)函数,它托管在 Azure 中。但是,当我开发面向 azure 函数的客户端应用程序时,我不想调用托管的 Azure 函数,而是从 Visual Studio 运行该函数并将调用重定向到此本地副本。

有没有办法让这个本地副本在本地机器的 Visual Studio 环境之外运行?也许像 Windows 服务?

任何对文章的引用都会很棒。如果问题不清楚,请告诉我。

【问题讨论】:

标签: azure windows-services azure-functions azure-web-app-service azure-http-trigger


【解决方案1】:

要在本地运行它,您可以使用以下命令模板。 我认为在 Topshelf 中使用它会在服务中运行它

C:\projectFolderPathWithi hostJsonFile> C:\Users\username\AppData\Local\AzureFunctionsTools\Releases\3.16.1\cli_x64\func 主机启动 --port 7072 --verbose --functions "func1" "func2"

【讨论】:

    【解决方案2】:

    正如 Kane 所说,如果你不想基于 Visual Studio,你可以使用 azure function core tools。

    https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Ccsharp%2Ccmd

    安装函数核心工具后,你可以使用命令func host start来运行你的函数应用。

    请注意,一次只能在本地启动一个函数应用,因为azure函数占用的端口在本地机器上都是7071。 local主要用于测试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多