您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

从门户手动安装或更新 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.azurewebsites.net/)。THe Kudu endpoint (https://<APP_NAME>.scm.azurewebsites.net/) 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. 可以在我需要哪些软件包? 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