如何发布到 Azure Functions Runtime
How to publish to Azure Functions Runtime
Azure Functions 运行时博客 post (https://azure.microsoft.com/en-us/blog/introducing-azure-functions-runtime-preview/) 声明如下:
It provides an endpoint that allows you to publish your functions from
Microsoft Visual Studio, Team Foundation Server, or Visual Studio Team
Services.
我找不到任何有关如何发布到 Azure Functions Runtime 的本地实例而不是 Azure 云的示例。我最好使用 Visual Studio 2017 Azure Functions 工具 (https://blogs.msdn.microsoft.com/webdev/2017/05/10/azure-function-tools-for-visual-studio-2017/).
发布预编译的 Azure Function
发件人:https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference
如何更新函数应用文件
Azure 门户中内置的函数编辑器可让您更新函数的 function.json
文件和代码文件。要上传或更新其他文件,例如 package.json
或 project.json
或依赖项,您必须使用其他部署方法。
函数应用构建于应用服务之上,因此所有 deployment options available to standard web apps 也可用于函数应用。以下是您可以用来上传或更新函数应用程序文件的一些方法。
使用应用服务编辑器
- 在 Azure Functions 门户中,单击“函数应用设置”。
- 在“高级设置”部分,单击“转到应用服务设置”。
- 在“开发工具”下的“应用菜单导航”中单击“应用服务编辑器”。
- 单击开始。
- 应用服务编辑器加载后,您将在
wwwroot
下看到 host.json
文件和函数文件夹。
- 打开文件进行编辑,或从您的开发计算机拖放文件以上传文件。
使用函数应用程序的 SCM (Kudu) 端点
- 导航至:
https://<function_app_name>.scm.azurewebsites.net
。
- 单击调试控制台 > CMD。
- 导航至
D:\home\site\wwwroot\
以更新 host.json
或 D:\home\site\wwwroot\<function_name>
以更新函数的文件。
- 将要上传的文件拖放到文件网格中的相应文件夹中。文件网格中有两个区域,您可以在其中放置文件。对于 .zip 文件,会出现一个带有标签 "Drag here to upload and unzip." 的框。对于其他文件类型,请放入文件网格但位于 "unzip" 框之外。
要使用FTP
- 按照此处的说明进行 FTP 配置。
- 当您连接到函数应用程序站点时,将更新的
host.json
文件复制到 /site/wwwroot
或将函数文件复制到 /site/wwwroot/<function_name>
。
要使用持续部署
按照主题 Continuous deployment for Azure Functions 中的说明进行操作。
发件人:https://docs.microsoft.com/en-us/azure/azure-functions/functions-runtime-overview
Azure Functions 运行时概述
Azure Functions Runtime 为你提供了一种新方法来利用本地 Azure Functions 编程模型的简单性和灵活性。 Azure Functions Runtime 建立在与 Azure Functions 相同的开源基础上,在本地部署以提供与云服务几乎相同的开发体验。
Azure Functions 运行时由两部分组成:
- Azure Functions 运行时管理角色
- Azure Functions 运行时辅助角色
Azure 函数管理角色
Azure Functions Management Role 为您的 Functions 本地管理提供了一个主机。此角色执行以下任务:
- 托管 Azure Functions 管理门户,与您在 Azure 门户中看到的相同。这使您可以像在 Azure 门户中一样开发函数。
- 跨多个 Functions worker 分配函数。
- 提供发布端点,以便您可以直接从 Microsoft Visual Studio.
发布您的函数
如果您阅读了 MSDN blog link that you provided,我想您的两个问题都在那里得到了解答。 (尽管您必须指向本地(本地)而不是云 (Azure)。
如何直接从 Visual Studio
将函数项目发布到 Azure
To publish a Function project to Azure directly from Visual Studio,
right click the project and choose “Publish”. On the publish page, you
can either create a new Function App in Azure or publish to an
existing one. Note: even though the Folder option is currently
appears, it’s not intended for use with Azure Functions at this time.
如何在Visual Studio
中本地部署一个Function项目
To add a function to the application right click the project and
choose “Add Item”, then choose the “Azure Function” item template.
This will launch the Azure Function dialog that enables you to choose
the type of function you want, and enter any relevant binding
information. For example, in the dialog below, the queue trigger asks
you for the name of the function, the name of the connection string to
the storage queue, and the name of the queue (path)
This generates a new class that has the following elements:
- A static Run method, that is attributed with [FunctionName] attribute.
The [FunctionName] attribute indicates that the method is the entry
for an Azure Function.
- The first parameter has a QueueTrigger
attribute, this is what indicates is a queue trigger function (and
takes the binding information as parameters to the attribute. In this
case the name of the queue and the connection string’s setting name)
Once you have a function, local development works like you would
expect. You can run and debug it locally, add NuGet packages, create
unit tests, and anything else you would do for a class library.
您可以通过从门户下载发布配置文件然后在 Visual Studio 2015 年的“发布...”对话框中导入它来将您的函数发布到 Azure Functions 运行时预览版:
关于VS2017工具支持,目前无法将发布设置导入发布对话框。我们目前正在与 VS 团队合作解决这个问题。
Azure Functions 运行时博客 post (https://azure.microsoft.com/en-us/blog/introducing-azure-functions-runtime-preview/) 声明如下:
It provides an endpoint that allows you to publish your functions from Microsoft Visual Studio, Team Foundation Server, or Visual Studio Team Services.
我找不到任何有关如何发布到 Azure Functions Runtime 的本地实例而不是 Azure 云的示例。我最好使用 Visual Studio 2017 Azure Functions 工具 (https://blogs.msdn.microsoft.com/webdev/2017/05/10/azure-function-tools-for-visual-studio-2017/).
发布预编译的 Azure Function发件人:https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference
如何更新函数应用文件
Azure 门户中内置的函数编辑器可让您更新函数的 function.json
文件和代码文件。要上传或更新其他文件,例如 package.json
或 project.json
或依赖项,您必须使用其他部署方法。
函数应用构建于应用服务之上,因此所有 deployment options available to standard web apps 也可用于函数应用。以下是您可以用来上传或更新函数应用程序文件的一些方法。
使用应用服务编辑器
- 在 Azure Functions 门户中,单击“函数应用设置”。
- 在“高级设置”部分,单击“转到应用服务设置”。
- 在“开发工具”下的“应用菜单导航”中单击“应用服务编辑器”。
- 单击开始。
- 应用服务编辑器加载后,您将在
wwwroot
下看到host.json
文件和函数文件夹。 - 打开文件进行编辑,或从您的开发计算机拖放文件以上传文件。
使用函数应用程序的 SCM (Kudu) 端点
- 导航至:
https://<function_app_name>.scm.azurewebsites.net
。 - 单击调试控制台 > CMD。
- 导航至
D:\home\site\wwwroot\
以更新host.json
或D:\home\site\wwwroot\<function_name>
以更新函数的文件。 - 将要上传的文件拖放到文件网格中的相应文件夹中。文件网格中有两个区域,您可以在其中放置文件。对于 .zip 文件,会出现一个带有标签 "Drag here to upload and unzip." 的框。对于其他文件类型,请放入文件网格但位于 "unzip" 框之外。
要使用FTP
- 按照此处的说明进行 FTP 配置。
- 当您连接到函数应用程序站点时,将更新的
host.json
文件复制到/site/wwwroot
或将函数文件复制到/site/wwwroot/<function_name>
。
要使用持续部署
按照主题 Continuous deployment for Azure Functions 中的说明进行操作。
发件人:https://docs.microsoft.com/en-us/azure/azure-functions/functions-runtime-overview
Azure Functions 运行时概述
Azure Functions Runtime 为你提供了一种新方法来利用本地 Azure Functions 编程模型的简单性和灵活性。 Azure Functions Runtime 建立在与 Azure Functions 相同的开源基础上,在本地部署以提供与云服务几乎相同的开发体验。
Azure Functions 运行时由两部分组成:
- Azure Functions 运行时管理角色
- Azure Functions 运行时辅助角色
Azure 函数管理角色
Azure Functions Management Role 为您的 Functions 本地管理提供了一个主机。此角色执行以下任务:
- 托管 Azure Functions 管理门户,与您在 Azure 门户中看到的相同。这使您可以像在 Azure 门户中一样开发函数。
- 跨多个 Functions worker 分配函数。
- 提供发布端点,以便您可以直接从 Microsoft Visual Studio. 发布您的函数
如果您阅读了 MSDN blog link that you provided,我想您的两个问题都在那里得到了解答。 (尽管您必须指向本地(本地)而不是云 (Azure)。
如何直接从 Visual Studio
将函数项目发布到 AzureTo publish a Function project to Azure directly from Visual Studio, right click the project and choose “Publish”. On the publish page, you can either create a new Function App in Azure or publish to an existing one. Note: even though the Folder option is currently appears, it’s not intended for use with Azure Functions at this time.
如何在Visual Studio
中本地部署一个Function项目To add a function to the application right click the project and choose “Add Item”, then choose the “Azure Function” item template. This will launch the Azure Function dialog that enables you to choose the type of function you want, and enter any relevant binding information. For example, in the dialog below, the queue trigger asks you for the name of the function, the name of the connection string to the storage queue, and the name of the queue (path)
This generates a new class that has the following elements:
- A static Run method, that is attributed with [FunctionName] attribute. The [FunctionName] attribute indicates that the method is the entry for an Azure Function.
- The first parameter has a QueueTrigger attribute, this is what indicates is a queue trigger function (and takes the binding information as parameters to the attribute. In this case the name of the queue and the connection string’s setting name)
Once you have a function, local development works like you would expect. You can run and debug it locally, add NuGet packages, create unit tests, and anything else you would do for a class library.
您可以通过从门户下载发布配置文件然后在 Visual Studio 2015 年的“发布...”对话框中导入它来将您的函数发布到 Azure Functions 运行时预览版:
关于VS2017工具支持,目前无法将发布设置导入发布对话框。我们目前正在与 VS 团队合作解决这个问题。