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

在 Windows 上准备开发环境Prepare your development environment on Windows

若要在 Windows 开发计算机上生成并运行 Azure Service Fabric 应用程序,请安装 Service Fabric 运行时、SDK 和工具。To build and run Azure Service Fabric applications on your Windows development machine, install the Service Fabric runtime, SDK, and tools. 此外,还需要启用 SDK 中包含的 Windows PowerShell 脚本执行You also need to enable execution of the Windows PowerShell scripts included in the SDK.

先决条件Prerequisites

支持的操作系统版本Supported operating system versions

支持使用以下操作系统版本进行开发:The following operating system versions are supported for development:

  • Windows 7Windows 7
  • Windows 8/Windows 8.1Windows 8/Windows 8.1
  • Windows Server 2012 R2Windows Server 2012 R2
  • Windows Server 2016Windows Server 2016
  • Windows 10Windows 10

备注

Windows 7 支持:

  • 默认情况下,Windows 7 仅包含 Windows PowerShell 2.0。 Service Fabric PowerShell cmdlet 需要 PowerShell 3.0 或更高版本。 可以从 Microsoft 下载中心下载 Windows PowerShell 5.0
  • 在 Windows 7 上无法使用 Service Fabric 反向代理。

安装 SDK 和工具Install the SDK and tools

使用 Visual Studio 2017To use Visual Studio 2017

Service Fabric 工具是 Visual Studio 2017 中 Azure 开发工作负荷的一部分。The Service Fabric Tools are part of the Azure Development workload in Visual Studio 2017. 在 Visual Studio 安装过程中启用此工作负荷。Enable this workload as part of your Visual Studio installation. 此外还需使用 Web 平台安装程序安装 Microsoft Azure Service Fabric SDK 和运行时。In addition, you need to install the Microsoft Azure Service Fabric SDK and runtime using Web Platform Installer.

使用 Visual Studio 2015(要求 Visual Studio 2015 Update 2 或更高版本)To use Visual Studio 2015 (requires Visual Studio 2015 Update 2 or later)

对于 Visual Studio 2015,Service Fabric 工具是使用 Web 平台安装程序与 SDK 和运行时 一起安装的:For Visual Studio 2015, the Service Fabric tools are installed together with the SDK and runtime using the Web Platform Installer:

仅安装 SDKSDK installation only

如果只需 SDK,可以安装此包:If you only need the SDK, you can install this package:

当前版本包括:The current versions are:

  • Service Fabric SDK and Tools 3.2.176Service Fabric SDK and Tools 3.2.176
  • Service Fabric 运行时 6.3.176Service Fabric runtime 6.3.176
  • Service Fabric Tools for Visual Studio 2015 2.3.10710.3Service Fabric Tools for Visual Studio 2015 2.3.10710.3
  • Visual Studio 2017 15.7 包括 Service Fabric Tools for Visual Studio 2.3.10710.1Visual Studio 2017 15.7 includes Service Fabric Tools for Visual Studio 2.3.10710.1

有关支持的版本列表,请参阅 Service Fabric 支持For a list of supported versions, see Service Fabric support

启用 PowerShell 脚本执行Enable PowerShell script execution

Service Fabric 使用 Windows PowerShell 脚本创建本地开发群集和部署 Visual Studio 中的应用程序。Service Fabric uses Windows PowerShell scripts for creating a local development cluster and for deploying applications from Visual Studio. 默认情况下,Windows 会阻止这些脚本运行。By default, Windows blocks these scripts from running. 要启用它们,必须修改 PowerShell 执行策略。To enable them, you must modify your PowerShell execution policy. 以管理员身份打开 PowerShell 并输入以下命令:Open PowerShell as an administrator and enter the following command:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser

安装 Docker(可选)Install Docker (optional)

Service Fabric 是容器业务流程协调程序,用于跨计算机群集部署微服务。Service Fabric is a container orchestrator for deploying microservices across a cluster of machines. 若要在本地开发群集上运行 Windows 容器应用程序,必须先安装用于 Windows 的 Docker。To run Windows container applications on your local development cluster, you must first install Docker for Windows. 获取用于 Windows 的 Docker CE (稳定版)Get Docker CE for Windows (stable). 安装并启动 Docker 以后,右键单击任务栏图标,并选择“切换到 Windows 容器”。After installing and starting Docker, right-click on the tray icon and select Switch to Windows containers. 此步骤是运行基于 Windows 的 Docker 映像所必需的。This step is required to run Docker images based on Windows.

后续步骤Next steps

完成设置开发环境之后,便可开始生成和运行应用。Now that you've finished setting up your development environment, start building and running apps.