通过 Azure 云和 Windows 容器现代化现有 .NET 应用程序(第 2 版)Modernize existing .NET applications with Azure cloud and Windows Containers (2nd edition)

现代化 .NET 应用程序指南的封面图像。

发布者PUBLISHED BY
Microsoft Press 和 Microsoft DevDivMicrosoft Press and Microsoft DevDiv
Microsoft Corporation 的部门Divisions of Microsoft Corporation
One Microsoft WayOne Microsoft Way
Redmond, Washington 98052-6399Redmond, Washington 98052-6399

版权所有 © 2018 Microsoft CorporationCopyright © 2018 by Microsoft Corporation

保留所有权利。All rights reserved. 未经发布者书面许可,不得以任何形式或任何方式复制本书中的任何内容。No part of the contents of this book may be reproduced in any form or by any means without the written permission of the publisher.

本书以电子书 (e-book) 形式免费提供,可通过 Microsoft 的多个通道获得,如 https://dot.net/architectureThis book is available for free in the form of an electronic book (e-book) available through multiple channels at Microsoft such as https://dot.net/architecture.

若要了解本书的相关问题,请发送电子邮件至 dotnet-architecture-ebooks-feedback@service.microsoft.comIf you have questions related to this book, email at dotnet-architecture-ebooks-feedback@service.microsoft.com.

本书“按原样”提供,表达作者的观点和看法。This book is provided "as-is" and expresses the author's views and opinions. 本书中表达的观点、看法和信息(包括 URL 和其他 Internet 网站引用)如有更改,恕不另行通知。The views, opinions, and information expressed in this book, including URL and other Internet website references, may change without notice.

本书中提及的一些示例仅用于说明,纯属虚构。Some examples depicted herein are provided for illustration only and are fictitious. 不存在任何实际关联或联系,请勿妄加推断。No real association or connection is intended or should be inferred.

Microsoft 和 https://www.microsoft.com 上“商标”网页列出的商标是 Microsoft 集团公司的商标。Microsoft and the trademarks listed at https://www.microsoft.com on the "Trademarks" webpage are trademarks of the Microsoft group of companies. 所有其他标记均为其各自所有者的财产。All other marks are property of their respective owners.

作者:Author:

Cesar de la Torre,Microsoft Corp .NET 产品团队的高级项目经理。Cesar de la Torre, Sr. PM, .NET Product Team, Microsoft Corp.

参与者和审阅者:Participants and reviewers:

Scott Hunter,Microsoft .NET 团队的合作伙伴总监项目经理Scott Hunter, Partner Director PM, .NET team, Microsoft
Paul Yuknewicz,Microsoft Visual Studio Tools 团队的主要项目经理Paul Yuknewicz, Principal PM Manager, Visual Studio Tools team, Microsoft
Lisa Guthrie,Microsoft Visual Studio Tools 团队的高级项目经理Lisa Guthrie, Sr. PM, Visual Studio Tools team, Microsoft
Ankit Asthana,Microsoft .NET 团队的主要项目经理Ankit Asthana, Principal PM Manager, .NET team, Microsoft
Unai Zorrilla,Plain Concepts 的开发者领导Unai Zorrilla, Developer Lead, Plain Concepts
Javier Valero,Grupo Solutio 的首席运营官Javier Valero, Chief Operating Officer at Grupo Solutio

介绍Introduction

决定现代化 Web 应用程序或服务并将其迁移到云时,无需完全重新构建应用。When you decide to modernize your web applications or services and move them to the cloud, you don't necessarily have to fully rearchitect your apps. 由于成本和时间限制,使用微服务之类的高级方法来重新构建应用程序并非始终可行。Rearchitecting an application by using an advanced approach like microservices isn't always an option because of cost and time restraints. 根据应用程序的类型,也可能无需重新构建应用。Depending on the type of application, rearchitecting an app also might not be necessary. 为了优化组织云迁移策略的成本效益,必须考虑业务和应用的需求。To optimize the cost-effectiveness of your organization's cloud migration strategy, it's important to consider the needs of your business and requirements of your apps. 需要确定:You'll need to determine:

  • 哪些应用需要转换或重新构建。Which apps require a transformation or rearchitecting.

  • 哪些应用只需部分更新。Which apps need to be only partially modernized.

  • 哪些应用能直接“直接迁移”到云。Which apps you can "lift and shift" directly to the cloud.

关于本指南About this guide

本指南主要重点介绍现有 Microsoft .NET Framework Web 应用程序或面向服务的应用程序的初始现代化,即将工作负荷移动到更新或更现代化的环境,而不会显著改变应用程序的代码和基本体系结构。This guide focuses primarily on initial modernization of existing Microsoft .NET Framework web or service-oriented applications, meaning the action of moving a workload to a newer or more modern environment without significantly altering the application's code and basic architecture.

本指南还强调使用一组特定的新技术和方法(如,Windows 容器和 Azure 中支持 Windows 容器的相关计算平台)将应用移动到云并部分现代化应用的益处。This guide also highlights the benefits of moving your apps to the cloud and partially modernizing apps by using a specific set of new technologies and approaches, like Windows Containers and related compute-platforms in Azure supporting Windows Containers.

将现有 .NET 应用程序迁移到云的途径Path to the cloud for existing .NET applications

组织通常选择移动到云来使其应用程序获得敏捷性和速度。Organizations typically choose to move to the cloud for the agility and speed they can get for their applications. 只需几分钟即可在云中设置数千台服务器 (VM),而设置本地服务器通常需要数周。You can set up thousands of servers (VMs) in the cloud in minutes, compared to the weeks it typically takes to set up on-premises servers.

将应用程序迁移到云没有普遍通用的策略。There isn't a single, one-size-fits-all strategy for migrating applications to the cloud. 合适的迁移方法由组织的需求和优先考虑事项,以及要迁移的应用程序种类决定。The right migration strategy for you will depend on your organization's needs and priorities, and the kind of applications you are migrating. 并非所有应用程序都保证可以移动到平台即服务 (PaaS) 模型或开发云原生应用程序模型。Not all applications warrant the investment of moving to a platform as a service (PaaS) model or developing a cloud-native application model. 许多情况下都可根据业务需求采用阶段性或递增性方法将资产移动到云。In many cases, you can take a phased or incremental approach to invest in moving your assets to the cloud, based on your business needs.

对于可为组织带来最佳长期敏捷性和价值的现代化应用程序,投资云本机应用程序体系结构是有益的。 For modern applications with the best long-term agility and value for the organization, you might benefit from investing in cloud-native application architectures. 但是,对于现有或旧的应用程序资产,关键在于用最少的时间和金钱将应用程序移动到云(无需重新构建或更改代码),从而实现显著的效益。However, for applications that are existing or legacy assets, the key is to spend minimal time and money (no rearchitecting or code changes) while moving them to the cloud, to realize significant benefits.

图 1-1 显示了采用递增性方法将现有 .NET 应用程序移动到云时可能使用的途径。Figure 1-1 shows the possible paths you can take when you move existing .NET applications to the cloud in incremental phases.

 现有 .NET 应用程序和服务的更新途径

图 1-1Figure 1-1. 现有 .NET 应用程序和服务的更新途径Modernization paths for existing .NET applications and services

每种迁移方法的优点和使用原因各不相同。Each migration approach has different benefits and reasons for using it. 可以选择一种方法将应用迁移到云,也可以从多种方法中选择某些组件。You can choose a single approach when you migrate apps to the cloud, or choose certain components from multiple approaches. 单个应用程序不限于单一的方法或成熟度状态。Individual applications aren't limited to a single approach or maturity state. 例如,常见的混合方法将包含某些本地组件以及云中的其他组件。For instance, a common hybrid approach would have certain on-premises components plus other components in the cloud.

每个应用程序成熟度的定义和简短说明如下所示:The definition and short explanation for each application maturity level are the following:

级别 1:云基础结构就绪的应用程序:使用此迁移方法,将当前本地应用程序迁移或重新托管到基础结构即服务 (IaaS) 平台即可。Level 1: Cloud Infrastructure-Ready applications: In this migration approach, you simply migrate or rehost your current on-premises applications to an infrastructure as a service (IaaS) platform. 应用的组成与之前基本一致,但现在可将它们部署到云中的 VM。Your apps have almost the same composition as before, but now you deploy them to VMs in the cloud. 这种简单类型的迁移在业内通常称为“直接迁移”。This simple type of migration is typically known in the industry as "Lift & Shift."

级别 2:云优化的应用程序:在此级别,仍无需重新架构或改写大量代码,可以利用容器和其他云托管服务等现代化技术在云中运行应用,从而获得更多益处。Level 2: Cloud Optimized applications: At this level and still without rearchitecting or altering significant code, you can gain additional benefits from running your app in the cloud with modern technologies like containers and additional cloud-managed services. 通过优化企业开发操作 (DevOps) 流程,可以提高应用程序的敏捷性,以实现更快交付。You improve the agility of your applications to ship faster by refining your enterprise development operations (DevOps) processes. 这可以通过使用某种技术(如基于 Docker 引擎的 Windows 容器)实现。You achieve this by using technologies like Windows Containers, which is based on Docker Engine. 分多个阶段部署时,容器可以消除因应用程序依赖项造成的冲突。Containers remove the friction that’s caused by application dependencies when you deploy in multiple stages. 在此成熟度模型中,可以在 IaaS 或 PaaS 上部署容器,同时使用与数据库、缓存即服务、监视以及持续集成/持续部署 (CI/CD) 管道相关的其他云托管服务。In this maturity model, you can deploy containers on IaaS or PaaS while using additional cloud-managed services related to databases, cache as a service, monitoring, and continuous integration/continuous deployment (CI/CD) pipelines.

第三个成熟度级别是云中的最终目标,但对于很多应用它是可选的,并不是本指南的主要重点:The third level of maturity is the ultimate goal in the cloud, but it's optional for many apps and not the main focus of this guide:

级别 3:云本机应用程序:此迁移方法通常由业务需求驱动,目的是更新任务关键型应用程序。Level 3: Cloud-Native applications: This migration approach typically is driven by business need and targets modernizing your mission-critical applications. 在此级别,使用 PaaS 服务将应用移动到 PaaS 计算平台。At this level, you use PaaS services to move your apps to PaaS computing platforms. 实现云原生应用程序和微服务体系结构,以改进应用程序,使其具有长期的敏捷性并扩展至新的限制。You implement cloud-native applications and microservices architecture to evolve applications with long-term agility, and to scale to new limits. 此类更新通常需要专门针对云进行构建。This type of modernization usually requires architecting specifically for the cloud. 通常必须编写新代码,尤其是移动到基于云原生应用程序和微服务的模型时。New code often must be written, especially when you move to cloud-native application and microservice-based models. 此方法有助于获得一些益处,这些益处在单片和本地应用程序环境中很难实现。This approach can help you gain benefits that are difficult to achieve in your monolithic and on-premises application environment.

表 1-1 介绍了选择每种迁移或更新方法的主要优点和原因。Table 1-1 describes the main benefits of and reasons for choosing each migration or modernization approach.

云基础结构就绪Cloud Infrastructure-Ready
直接迁移Lift and shift
云优化Cloud-Optimized
现代化Modernize
云本机Cloud-Native
现代化、重新架构和重写Modernize, rearchitect and rewrite
应用程序的计算目标Application's compute target
部署到 Azure 中 VM 的应用程序Applications deployed to VMs in Azure 部署到 Azure 应用服务、Azure 容器实例 (ACI)、包含容器的 VM 或 AKS(Azure Kubernetes 服务)的单层或 N 层应用Monolithic or N-Tier apps deployed to Azure App Service, Azure Container Instance (ACI), VMs with containers, or AKS (Azure Kubernetes Service) Azure Kubernetes 服务 (AKS) 上的容器化的微服务和/或基于 Azure Functions 的无服务器微服务。Containerized microservices on Azure Kubernetes Service (AKS) and/or serverless microservices based on Azure Functions.
数据目标Data target
VM 中的 SQL 或任何关系数据库SQL or any relational database on a VM Azure SQL 数据库托管实例或云中的其他托管数据库。Azure SQL Database Managed Instance or another managed database in the cloud. 针对每项微服务的精细数据库,基于 Azure SQL 数据库、Azure Cosmos DB 或云中其他托管数据库Fined-grain databases per microservice, based on Azure SQL Database, Azure Cosmos DB, or another managed database in the cloud
优点Advantages
  • 无需重新架构,无需编写新代码No rearchitecting, no new code
  • 需要的工作量最少,实现快速迁移Least effort for quick migration
  • Azure 中支持最小公分母Least-common denominator supported in Azure
  • 保证基本可用性Basic availability guarantees
  • 移动到云后,更容易更新After moving to the cloud, it's easier to modernize even more
  • 无需重新架构No rearchitecting
  • 极少代码/配置更改Minimal code/config changes
  • 由于容器的原因,改进了部署和 DevOps 发布敏捷性Improved deployment and DevOps agility to release because of containers
  • 增加了密度,降低了部署成本Increased density and lower deployment costs
  • 应用的可移植性和依赖项Portability of apps and dependencies
  • 主机目标的灵活性:PaaS 方法或 IaaSFlexibility of host targets: PaaS approaches or IaaS
  • 针对云进行架构,可以从云获得最大优势,但需要新代码Architect for the cloud, you get the best benefits from the cloud but new code is needed
  • 微服务云原生方法Microservices cloud-native approaches
  • 现代化任务关键型应用程序,具有云复原能力,可实现超大规模缩放Modern mission-critical applications, cloud-resilient hyper-scalable
  • 完全托管服务Fully managed services
  • 优化了规模Optimized for scale
  • 通过子系统优化了自主敏捷性Optimized for autonomous agility by subsystem
  • 基于部署和 DevOpsBuilt on deployment and DevOps
  • 挑战Challenges
  • 除了转移运营费用或关闭数据中心之外,云价值较小Smaller cloud value, other than shift in operating expense or closing datacenters
  • 几乎无需管理:无 OS 或中间件修补;可使用基础架构解决方案,如 Terraform、Spinnaker 或 PuppetLittle is managed: No OS or middleware patching; might use infrastructure solutions, like Terraform, Spinnaker, or Puppet
  • 容器化是开发者和 IT 运营学习曲线中一个额外的步骤Containerizing is an additional step in the learning curve for developers and IT Operations
  • DevOps 和 CI/CD 管道通常是此方法的“必备品”。DevOps and CI/CD pipelines are usually ‘a must’ for this approach. 如果组织文化中当前没有这些必备品,这可能是一个额外的挑战If not currently present in the culture of the organization, it might be an additional challenge
  • 进行现代化时,需要重新架构云本机应用和微服务体系结构,并且通常需要进行大量的代码重构或重写(增加时间和预算)Requires rearchitecture for cloud native apps and microservice architectures and usually requires significant code refactoring or rewriting when modernizing (increased time and budget)
  • 表 1-1Table 1-1. 现有 .NET 应用程序和服务的更新途径的优势和挑战Benefits and challenges of modernization paths for existing .NET applications and services

    各成熟度级别使用的关键技术和体系结构Key technologies and architectures by maturity level

    .NET Framework 应用程序的初始版本为 .NET Framework 1.0,该版本于 2001 年年底发布。.NET Framework applications initially started with the .NET Framework version 1.0, which was released in late 2001. 然后,公司发布了更新的版本(如 2.0、3.5 和 .NET 4.x)。Then, companies moved towards newer versions (such as 2.0, 3.5 and .NET 4.x). 这些应用程序中的大部分都在 Windows Server 和 Internet Information Server (IIS) 上运行,并使用关系数据库,如 SQL Server、Oracle、MySQL 或任何其他关系数据库管理系统。Most of those applications ran on Windows Server and Internet Information Server (IIS), and used a relational database, like SQL Server, Oracle, MySQL, or any other RDBMS.

    当今大部分现有 .NET 应用程序可能都基于 .NET Framework 4.x,甚至 .NET Framework 3.5,并使用 Web 框架,如 ASP.NET MVC、ASP.NET Web 窗体、ASP.NET Web API、Windows Communication Foundation (WCF)、ASP.NET SignalR 和 ASP.NET 网页。Most existing .NET applications might nowadays be based on .NET Framework 4.x, or even on .NET Framework 3.5, and use web frameworks like ASP.NET MVC, ASP.NET Web Forms, ASP.NET Web API, Windows Communication Foundation (WCF), ASP.NET SignalR, and ASP.NET Web Pages. 这些既定的 .NET Framework 技术都依赖于 Windows。These established .NET Framework technologies depend on Windows. 如果只是简单地迁移旧版应用并希望对应用程序基础结构作出最少的更改,依赖项是一项重要的考虑因素。That dependency is important to consider if you are simply migrating legacy apps and you want to make minimal changes to your application infrastructure.

    图 1-2 显示了三个云成熟度级别中每一个级别所使用的主要技术和体系结构样式:Figure 1-2 shows the primary technologies and architecture styles used at each of the three cloud maturity levels:

    用于更新现有 .NET Web 应用程序的每个成熟度级别的主要技术

    图 1-2Figure 1-2. 用于更新现有 .NET Web 应用程序的每个成熟度级别的主要技术Primary technologies for each maturity level for modernizing existing .NET web applications

    图 1-2 强调了最常见的方案,但在体系结构方面,可能存在许多混合变体。Figure 1-2 highlights the most common scenarios, but many hybrid and mixed variations are possible when it comes to architecture. 例如,成熟度模型不仅适用于现有 Web 应用的单片体系结构,还适用于服务方向、N 层以及其他体系结构样式变体。For example, the maturity models apply not only to monolithic architectures in existing web apps, but also to service orientation, N-Tier, and other architecture style variations. 一种或另一种体系结构类型及相关技术的关注度或占比更高,决定了应用程序的总体成熟度。The higher focus or percentage on one or another architecture type and related technologies determines the overall maturity level of your applications.

    更新流程中的每个成熟度级别与以下关键技术和方法相关:Each maturity level in the modernization process is associated with the following key technologies and approaches:

    • 云基础结构就绪(重新托管或基础直接迁移):作为第一步,很多组织只想快速执行云迁移策略。Cloud Infrastructure-Ready (rehost or basic lift & shift): As a first step, many organizations want only to quickly execute a cloud-migration strategy. 在这种情况下,要重新托管应用程序。In this case, applications are rehosted. 大多数重新托管均可使用 Azure Migrate 自动完成,该服务提供指南、见解和机制,帮助迁移到基于 Azure 的云工具(如 Azure Site RecoveryAzure 数据库迁移服务)。Most rehosting can be automated by using Azure Migrate, a service that provides the guidance, insights, and mechanisms needed to assist you in migrating to Azure based on cloud tools like Azure Site Recovery and Azure Database Migration Service. 也可以手动设置重新托管,以便在将旧版应用移动到云时了解关于这些资产的基础结构详细信息。You can also set up rehosting manually, so that you can learn infrastructure details about your assets when you move legacy apps to the cloud. 例如,可以在只做些许更改(或许只对配置做出细微更改)的情况下将应用程序移动到 Azure 中的 VM。For example, you can move your applications to VMs in Azure with little modification-probably with only minor configuration changes. 这种情况下的网络类似于本地环境,尤其是在 Azure 中创建虚拟网络时。The networking in this case is similar to an on-premises environment, especially if you create virtual networks in Azure.

    • 云优化(托管服务和 Windows 容器):此模型进行了一些重要的部署优化,可获得云带来的显著益处,并且不需要更改应用程序的核心体系结构。Cloud-Optimized (Managed Services and Windows Containers): This model is about making a few important deployment optimizations to gain some significant benefits from the cloud, without changing the core architecture of the application. 此处的基本步骤是对现有 .NET Framework 应用程序增加 Windows 容器 支持。The fundamental step here is to add Windows Containers support to your existing .NET Framework applications. 此重要步骤(容器化)不需要触及代码,因此直接迁移的总体工作量很少。This important step (containerization) doesn't require touching the code, so the overall lift and shift effort is light. 可以使用 Image2Docker 或 Visual Studio 之类的工具,Visual Studio 带有适用于 Docker 的工具。You can use tools like Image2Docker or Visual Studio, with its tools for Docker. Visual Studio 自动为 ASP.NET 应用程序和 Windows 容器映像选择智能默认值。Visual Studio automatically chooses smart defaults for ASP.NET applications and Windows Containers images. 这些工具提供快速内部循环,并提供将容器迁移到 Azure 的快速途径。These tools offer both a rapid inner loop, and a fast path to get the containers to Azure. 部署到多个环境中时,敏捷性得到提高。Your agility is improved when you deploy to multiple environments. 然后,要迁移到生产环境,可以将 Windows 容器部署到用于容器的 Azure Web 应用Azure 容器实例 (ACI);如果更希望采用 IaaS 方法,还可部署到具有 Windows Server 2016 和容器的 Azure VM。Then, moving to production, you can deploy your Windows Containers to Azure Web App for Containers, Azure Container Instances (ACI), and Azure VMs with Windows Server 2016 and containers if you prefer an IaaS approach. 对于更复杂的多容器应用程序,请考虑使用 Azure Kubernetes 服务 (AKS/ACS) 等业务流程协调程序。For more complex multi-container applications, consider using orchestrators like Azure Kubernetes Service (AKS/ACS).

    初次更新期间,还可以从云中添加资产,如使用如下工具进行监视:Azure Application Insights适用于应用生命周期且带 Azure DevOps 服务的 CI/CD 管道,以及 Azure 中提供的许多其他数据资源服务。During this initial modernization, you can also add assets from the cloud, such as monitoring with tools like Azure Application Insights; CI/CD pipelines for your app lifecycles with Azure DevOps Services; and many more data resource services that are available in Azure. 例如,可以修改单片 Web 应用,该应用最初使用传统 ASP.NET Web 窗体ASP.NET MVC 开发,但现在使用 Windows 容器部署。For instance, you can modify a monolithic web app that was originally developed by using traditional ASP.NET Web Forms or ASP.NET MVC, but now you deploy it by using Windows Containers. 使用 Windows 容器时,还需要将数据迁移到 Azure SQL 数据库托管实例中的数据库,但不需要更改应用程序的核心体系结构。When you use Windows Containers, you should also migrate your data to a database in Azure SQL Database Managed Instance, all without changing the core architecture of your application.

    • 云本机:如上所述,在以大型复杂应用程序为目标,由多个独立开发团队独立开发和部署不同的微服务时,应考虑架构云本机应用程序。Cloud-Native: As introduced, you should think about architecting cloud-native applications when you are targeting large and complex applications with multiple independent development teams working on different microservices that can be developed and deployed autonomously. 此外,还有一个原因是每个微服务有精细化且独立的可扩展性。Also, due to granularized and independent scalability per microservice. 这种体系结构方法面临着非常重要的挑战和复杂性,但使用云 PaaS、Azure Kubernetes 服务 (AKS/ACS)(托管 Kubernetes)等业务流程协调程序和 Azure Functions 构建无服务器方法,可大大简化工作。These architectural approaches face very important challenges and complexities but can be greatly simplified by using cloud PaaS and orchestrators like Azure Kubernetes Service (AKS/ACS) (managed Kubernetes), and Azure Functions for a serverless approach. 以上所有方法(如微服务和无服务器)通常需要架构云并编写新代码,新代码应适用于特定的 PaaS 平台或符合特定的体系结构(如微服务)。All these approaches (like microservices and Serverless) typically require you to architect for the cloud and write new code—code that is adapted to specific PaaS platforms, or code that aligns with specific architectures, like microservices.

    图 1-3 显示了每个成熟度级别可使用的内部技术:Figure 1-3 shows the internal technologies that you can use for each maturity level:

    每个更新成熟度级别可使用的内部技术

    图 1-3Figure 1-3. 每个更新成熟度级别可使用的内部技术Internal technologies for each modernization maturity level

    直接迁移方案Lift and shift scenario

    对于直接迁移,请记住,在应用程序方案中可以使用很多不同的直接迁移变体。For lift and shift migrations, keep in mind that you can use many different variations of lift and shift in your application scenarios. 如果仅重新托管应用程序,则可能拥有类似于图 1-4 中所示的方案,在此方案中,仅对应用程序和数据库服务器使用云中的 VM。If you only rehost your application, you might have a scenario like the one shown in Figure 1-4, where you use VMs in the cloud only for your application and for your database server.

    云中纯 IaaS 方案的示例

    图 1-4Figure 1-4. 云中纯 IaaS 方案的示例Example of a pure IaaS scenario in the cloud

    现代化方案Modernization scenarios

    对于现代化方案,你可能拥有一个纯云优化的应用程序,该应用程序仅使用该成熟度级别的元素。For modernization scenarios, you might have a pure Cloud-Optimized application that uses elements only from that maturity level. 或者,你可能拥有中间状态的应用程序,该应用程序同时使用云基础结构就绪级别的元素以及云优化级别的其他元素(“挑选”或混合模型),如图 1-5。Or, you might have an intermediate-state application with some elements from Cloud Infrastructure-Ready and other elements from Cloud-Optimized (a "pick and choose" or mixed model), like in Figure 1-5.

    “挑选”方案示例,使用 IaaS 数据库、DevOps 和容器化资产

    图 1-5Figure 1-5. “挑选”方案示例,使用 IaaS 数据库、DevOps 和容器化资产Example "pick and choose" scenario, with database on IaaS, DevOps, and containerization assets

    对于要迁移的许多现有 .NET Framework 应用程序而言,理想的方案是迁移到云优化应用程序,以实现事半功倍。Next, as the ideal scenario for many existing .NET Framework applications to migrate, you could migrate to a Cloud-Optimized application, to get significant benefits from little work. 使用这种方法,将来还可进一步实现云本机。This approach also sets you up for Cloud-Native as a possible future evolution. 图 1-6 显示了一个示例。Figure 1-6 shows an example.

    云优化应用方案示例,使用 Windows 容器和托管服务

    图 1-6Figure 1-6. 云优化应用方案示例,使用 Windows 容器和托管服务Example Cloud-Optimized apps scenario, with Windows Containers and managed services

    你可以通过为特定方案添加若干微服务来扩展现有的云优化应用程序。Going even further, you could extend your existing Cloud-Optimized application by adding a few microservices for specific scenarios. 这会将你部分移动到云本机级别,当前指南不重点介绍此部分。This would move you partially to the level of Cloud-Native model, which is not the main focus of the present guidance.

    本指南未涵盖的内容What this guide does not cover

    本指南涵盖了一小部分特定的示例方案,如图 1-7 所示。This guide covers a specific subset of the example scenarios, as shown in Figure 1-7. 本指南仅着重介绍直接迁移方案,最终着重介绍云优化模型。This guide focuses only on lift and shift scenarios, and ultimately, on the Cloud-Optimized model. 在云优化模型中,.NET Framework 应用程序使用 Windows 容器以及额外的组件(如监视和 CI/CD 管道)进行更新。In the Cloud-Optimized model, a .NET Framework application is modernized by using Windows Containers, plus additional components like monitoring and CI/CD pipelines. 每个组件都是确保将应用程序更快地、敏捷地部署到云的基础。Each component is fundamental to deploying applications to the cloud, faster, and with agility.

    本指南不涉及云本机

    图 1-7Figure 1-7. 本指南不涉及云本机Cloud-Native is not covered in this guide

    本指南的重点具有一定的针对性。The focus of this guide is specific. 本指南介绍了直接迁移现有 .NET 应用程序而不重新构建和更改代码的途径。It shows you the path you can take to achieve a lift and shift of your existing .NET applications, without rearchitecting, and with no code changes. 最终,介绍了如何实现应用程序云优化。Ultimately, it shows you how to make your application Cloud-Optimized.

    本指南不介绍如何创建云本机应用程序,例如如何进步成为微服务体系结构。This guide doesn't show you how to create Cloud-Native applications, such as how to evolve to a microservices architecture. 若要重新构建应用程序或创建基于微服务的全新应用程序,请参阅电子书 .NET 微服务:适用于容器化 .NET 应用程序的体系结构To rearchitect your applications or to create brand-new applications that are based on microservices, see the e-book .NET Microservices: Architecture for containerized .NET applications.

    其他资源Additional resources

    • 使用 Microsoft 平台和工具的容器化 Docker 应用程序生命周期(可下载的电子书)Containerized Docker application lifecycle with Microsoft platform and tools (downloadable e-book)
      https://aka.ms/dockerlifecycleebook

    • .NET 微服务:适用于容器化 .NET 应用程序的体系结构(可下载的电子书).NET Microservices: Architecture for containerized .NET applications (downloadable e-book)
      https://aka.ms/microservicesebook

    • 使用 ASP.NET Core 和 Azure 构建新式 Web 应用程序(可下载电子书)Architecting modern web applications with ASP.NET Core and Azure (downloadable e-book)
      https://aka.ms/webappebook

    本指南的目标读者Who should use this guide

    本指南适用于以下开发者和解决方案架构师:希望更新基于 .NET Framework 的现有 ASP.NET Web 应用程序或 WCF 服务,以提高交付和发布应用程序的敏捷性。This guide was written for developers and solution architects who want to modernize existing ASP.NET web applications or WCF services that are based on the .NET Framework, for improved agility in shipping and releasing applications.

    本指南可能也对技术决策者有帮助,例如希望大概了解使用 Windows 容器和使用 Microsoft Azure 部署到云可以获得哪些好处的企业架构师或开发负责人/主管。You also might find this guide useful if you are a technical decision maker, such as an enterprise architect or a development lead/director who just wants an overview of the benefits that you can get by using Windows Containers, and by deploying to the cloud when using Microsoft Azure.

    如何使用本指南How to use this guide

    本指南解释了需要更新现有应用程序的原因,以及使用 Windows 容器将应用移动到云能获得的具体好处。This guide addresses the "why"-why you might want to modernize your existing applications, and the specific benefits you get from using Windows Containers when you move your apps to the cloud. 本指南前几章的内容适用于架构师和技术决策者,他们只需大概了解,不需要实现和技术分步细节。The content in the first few chapters of the guide is designed for architects and technical decision makers who want an overview, but who don't need to focus on implementation and technical, step-by-step details.

    本指南最后一章介绍重点针对特定部署方案的多个演练。The last chapter of this guide introduces multiple walkthroughs that focus on specific deployment scenarios. 本指南提供了简要的演练版本,概况各种方案并突出其优点。This guide offers shorter versions of the walkthroughs, to summarize the scenarios and highlight their benefits. 完整演练深入到了设置和实现细节,并作为一组 Wiki 文章在相同的公共 GitHub 存储库中发布,该存储库中还存放着相关示例应用(将在下一节讨论)。The full walkthroughs drill down into setup and implementation details, and are published as a set of wiki posts in the same public GitHub repo where related sample apps reside (discussed in the next section). 关注实现细节的开发者和架构师将对最后一章以及 GitHub 上的分步 Wiki 演练更感兴趣。The last chapter and the step-by-step wiki walkthroughs on GitHub will be of more interest to developers and architects who want to focus on implementation details.

    用于更新旧版应用的示例应用:eShopModernizingSample apps for modernizing legacy apps: eShopModernizing

    GitHub 上的 EShopModernizing 存储库提供了两个示例应用程序,用以模拟旧版单片 Web 应用程序。The eShopModernizing repo on GitHub offers two sample applications that simulate legacy monolithic web applications. 第一个 Web 应用是用 ASP.NET MVC 开发的;第二个 Web 应用是用 ASP.NET Web Forms 开发的;三个应用是一个 N 层应用,其 WinForms 客户端桌面应用使用 WCF 服务后端。One web app is developed by using ASP.NET MVC; the second web app is developed by using ASP.NET Web Forms and the third app is an N-Tier app with a WinForms client desktop app consuming a WCF service backend. 这些应用都基于传统 .NET Framework。All these apps are based on the traditional .NET Framework. 这些示例应用不使用 .NET Core 或 ASP.NET Core,它们是要更新的现有/旧版 .NET Framework 应用程序。These sample apps don't use .NET Core or ASP.NET Core as they are supposed to be existing/legacy .NET Framework applications to be modernized.

    这些示例应用都有第二个版本,它们使用现代化代码,十分直接。These sample apps have a second version, with modernized code, and which are fairly straightforward. 两个应用版本之间最重要的差异是第二个版本使用 Windows 容器作为部署选项。The most important difference between the app versions is that the second versions use Windows Containers as the deployment choice. 第二个版本中还新增了一些组件,如用于管理映像的 Azure 存储 Blobs、管理安全的 Azure Active Directory,以及用于监视和审核应用程序的 Azure Application Insights。There also are a few additions to the second versions, like Azure Storage Blobs for managing images, Azure Active Directory for managing security, and Azure Application Insights for monitoring and auditing the applications.

    提供你的反馈Send your feedback

    我们创作本指南,是为了帮助你了解改进和现代化现有 .NET Web 应用程序的选项。This guide was written to help you understand your options for improving and modernizing existing .NET web applications. 本指南以及相关示例应用程序不断更新。The guide and related sample applications are evolving. 欢迎提供反馈意见!Your feedback is welcome! 如有关于本指南的改进建议,请将其发送到 dotnet-architecture-ebooks-feedback@service.microsoft.comIf you have comments about how this guide might be more helpful, please send them to dotnet-architecture-ebooks-feedback@service.microsoft.com.