从门户中手动安装或更新 Azure Functions 绑定扩展Manually install or update Azure Functions binding extensions from the portal

Azure Functions 版本 2.x 运行时使用绑定扩展实现触发器和绑定的代码。The Azure Functions version 2.x runtime uses binding extensions to implement code for triggers and bindings. NuGet 程序包中提供了绑定扩展。Binding extensions are provided in NuGet packages. 注册某个扩展,实质上是安装某个程序包。To register an extension, you essentially install a package. 开发函数时,你安装绑定扩展的方式取决于开发环境。When developing functions, the way that you install binding extensions depends on the development environment. 有关详细信息,请参阅“触发器和绑定”一文中的注册绑定扩展For more information, see Register binding extensions in the triggers and bindings article.

有时候,你需要在 Azure 门户中手动安装或更新绑定扩展。Sometimes you need to manually install or update your binding extensions in the Azure portal. 例如,可能需要将某个已注册的绑定更新为较新的版本。For example, you may need to update a registered binding to a newer version. 你可能还需要注册无法在门户的“集成”选项卡中安装的受支持绑定。You may also need to register a supported binding that can't be installed in the Integrate tab in the portal.

安装绑定扩展Install a binding extension

使用以下步骤从门户中手动安装或更新扩展。Use the following steps to manually install or update extensions from the portal.

  1. Azure 门户中,找到你的函数应用并选择它。In the Azure portal, locate your function app and select it. 选择“概述”选项卡并选择“停止”。Choose the Overview tab and select Stop. 停止函数应用将解锁文件,以便可以进行更改。Stopping the function app unlocks files so that changes can be made.

  2. 选择“平台功能”选项卡,在“开发工具”下选择“高级工具(Kudu)”。Choose the Platform features tab and under Development tools select Advanced Tools (Kudu). Kudu 终结点 (https://<APP_NAME>.scm.chinacloudsites.cn/) 将在一个新窗口中打开。THe Kudu endpoint (https://<APP_NAME>.scm.chinacloudsites.cn/) is opened in a new window.

  3. 在 Kudu 窗口中,选择“调试控制台” > “CMD”。In the Kudu window, select Debug console > CMD.

  4. 在命令窗口中,导航到 D:\home\site\wwwroot 并选择 bin 旁边的删除图标以删除文件夹。In the command window, navigate to D:\home\site\wwwroot and choose the delete icon next to bin to delete the folder. 选择“确定”以确认删除。Select OK to confirm the deletion.

  5. 选择 extensions.csproj 文件旁边的编辑按钮,该文件定义了函数应用的绑定扩展。Choose the edit icon next to the extensions.csproj file, which defines the binding extensions for the function app. 项目文件将从在线编辑器中打开。The project file is opened in the online editor.

  6. ItemGroup 中对 PackageReference 项进行必要的添加和更新,然后选择“保存”。Make the required additions and updates of PackageReference items in the ItemGroup, then select Save. 可以在 What packages do I need?(我需要哪些程序包?)wiki 文章中找到受支持程序包版本的当前列表。The current list of supported package versions can be found in the What packages do I need? wiki article. 三个 Azure 存储绑定都需要 Microsoft.Azure.WebJobs.Extensions.Storage 程序包。All three Azure Storage bindings require the Microsoft.Azure.WebJobs.Extensions.Storage package.

  7. wwwroot 文件夹中,运行以下命令以在 bin 文件夹中重新生成所引用的程序集。From the wwwroot folder, run the following command to rebuild the referenced assemblies in the bin folder.

    dotnet build extensions.csproj -o bin --no-incremental --packages D:\home\.nuget
    
  8. 返回到门户中的“概述”选项卡,选择“启动”以重启函数应用。Back in the Overview tab in the portal, choose Start to restart the function app.

后续步骤Next steps