将现有 .NET Azure 移动服务升级到应用服务Upgrade your existing .NET Azure Mobile Service to App Service

应用服务移动应用是使用 Azure 生成移动应用程序的新方式。App Service Mobile is a new way to build mobile applications using Azure. 若要了解详细信息,请参阅什么是移动应用?To learn more, see What are Mobile Apps?.

本主题介绍如何将现有 .NET 后端应用程序从 Azure 移动服务升级到新的应用服务移动应用。This topic describes how to upgrade an existing .NET backend application from Azure Mobile Services to a new App Service Mobile Apps. 执行此升级时,现有移动服务应用程序可以继续正常运行。While you perform this upgrade, your existing Mobile Services application can continue to operate. 如果需要升级 Node.js 后端应用程序,请参阅升级 Node.js 移动服务If you need to upgrade a Node.js backend application, refer to Upgrading your Node.js Mobile Services.

将某个移动后端升级到 Azure 应用服务后,该后端即可访问所有应用服务功能,同时会根据应用服务定价而不是移动服务定价进行计费。When a mobile backend is upgraded to Azure App Service, it has access to all App Service features and are billed according to App Service pricing, not Mobile Services pricing.

迁移与升级Migrate vs. upgrade

有两种方式可从移动服务移至应用服务:迁移或升级。There are two options for moving from Mobile Services to App Service: migration or upgrade. 两种都可赋予访问应用服务中所有托管功能的权限:Either option will give you access to all of the hosting capabilities of App Service:

  • 迁移 服务仅会更改托管移动后端的基础环境。Migrating a service just changes the underlying environment that hosts your mobile backend. 它要求移动客户端或移动服务器项目 无任何代码更改It requires no code changes to either the mobile client or the mobile server project. 若使用自动迁移选项,这会保留 service.azure-mobile.cn URL。If you use the automated migration option, this preserves your service.azure-mobile.cn URL.

  • 升级 服务要求服务器和客户端项目均 出现代码更改 ,但允许使用新的移动 SDK 功能,例如改进后的身份验证和更灵活的服务器项目。Upgrading a service does require code changes to both your server and client project, but allows you to take advantage of new mobile SDK features, such as improvements to authentication and more flexibility for your server project.

移动应用 .NET 服务器 SDK 改进Improvements in Mobile Apps .NET server SDK

升级到新 移动应用 SDK 可获得以下好处:Upgrading to the new Mobile Apps SDK provides the following benefits:

  • NuGet 依赖项有更大的灵活性。More flexibility on NuGet dependencies. 宿主环境不再提供其自身的 NuGet 包版本,因此可以使用替代的兼容版本。The hosting environment no longer provides its own versions of NuGet packages, so you can use alternative compatible versions. 但是,如果移动服务器 SDK 或依赖项有新的关键 Bug 修复或安全更新,则必须手动更新服务。However, if there are new critical bugfixes or security updates to the Mobile Server SDK or dependencies, you must update your service manually.

  • 移动 SDK 有更大的灵活性。More flexibility in the mobile SDK. 可以明确控制要设置哪些功能和路由,例如身份验证、表 API 和推送注册终结点。You can explicitly control which features and routes are set up, such as authentication, table APIs, and the push registration endpoint. 若要了解详细信息,请参阅如何使用适用于 Azure 移动应用的 .NET 服务器 SDKTo learn more, see How to use the .NET server SDK for Azure Mobile Apps.

  • 支持其他 ASP.NET 项目类型和路由。Support for other ASP.NET project types and routes. 现在,可以在与移动后端项目相同的项目中托管 MVC 和 Web API 控制器。You can now host MVC and Web API controllers in the same project as your mobile backend project.

  • 支持新的应用服务身份验证功能,允许跨 Web 应用和移动应用使用常见的身份验证配置。Support for new App Service authentication features, which allow you to use a common authentication configuration across your web and mobile apps.

基本升级概述Basic upgrade overview

在许多情况下,只需切换到新的移动应用服务器 SDK 并将代码重新发布到新的移动应用实例,即可完成升级。In many cases, upgrading will be as simple as switching to the new Mobile Apps server SDK and republishing your code onto a new Mobile App instance. 但在某些情况下则需要一些额外的配置,例如高级身份验证方案和使用计划作业。There are, however some scenarios which will require some additional configuration, such as advanced authentication scenarios and working with scheduled jobs. 后续部分逐一介绍。Each of these is covered in the later sections.

Tip

建议先阅读并充分了解本主题的余下内容,再开始升级。It is advised that you read and understand the rest of this topic completely before starting an upgrade. 请记下以下概括的所有功能。Make note of any features you use which are called out below.

移动服务客户端 SDK 与新的移动应用服务器 SDK 兼容。The Mobile Services client SDKs are not compatible with the new Mobile Apps server SDK. 为了提供应用程序的服务连续性,不应该将更改发布到当前正在为发布的客户端提供服务的站点。In order to provide continuity of service for your app, you should not publish changes to a site currently serving published clients. 而应该创建新的移动应用作为副本。Instead, you should create a new mobile app that serves as a duplicate. 可以在同一个应用服务计划中放置此应用程序,以免产生额外的财务成本。You can put this application on the same App Service plan to avoid incurring additional financial cost.

这样,就会获得两个版本的应用程序:一个保持不变并为已发布的现有应用程序提供服务,另一个则可升级且目标为新的客户端版本。You will then have two versions of the application: one which stays the same and serves published apps in the wild, and the other which you can then upgrade and target with a new client release. 可根据自己的步调移动和测试代码,但应确保所做的任何 bug 修复都已应用到这两个版本。You can move and test your code at your pace, but you should make sure that any bug fixes you make get applied to both. 觉得已将所需数量的现有客户端应用升级到最新版本后,可以根据需要删除已迁移的原始应用。Once you feel that a desired number of client apps in the wild have updated to the latest version, you can delete the original migrated app if you desire.

完整的升级过程大致如下:The full outline for the upgrade process is as follows:

  1. 创建新的移动应用Create a new Mobile App
  2. 更新项目以使用新的服务器 SDKUpdate the project to use the new Server SDKs
  3. 发布新版客户端应用程序Release a new version of your client application
  4. (可选)删除已迁移的原始实例(Optional) Delete your original migrated instance

创建第二个应用程序实例Creating a second application instance

升级的第一个步骤是创建用于托管新版应用程序的移动应用资源。The first step in upgrading is to create the Mobile App resource which will host the new version of your application. 如果已迁移现有移动服务,则需要在同一个托管计划中创建此版本。If you have already migrated an existing mobile service, you will want to create this version on the same hosting plan. 打开 Azure 门户 ,导航到已迁移的应用程序。Open the Azure portal and navigate to your migrated application. 记下运行该应用程序的应用服务计划。Make note of the App Service Plan it is running on.

接下来,根据 .NET 后端创建说明创建第二个应用程序实例。Next, create the second application instance by following the .NET backend creation instructions. 当系统提示选择应用服务计划或“托管计划”时,请选择已迁移的应用程序的计划。When prompted to select you App Service Plan or "hosting plan" choose the plan of your migrated application.

可能需要使用与移动服务中相同的数据库和通知中心。You will likely want to use the same database and Notification Hub as you did in Mobile Services. 可以打开 Azure 门户并导航到原始应用程序,复制这些值,然后单击“设置” > “应用程序设置”。You can copy these values by opening Azure portal and navigating to the original application, then click Settings > Application settings. 在“连接字符串”下,复制 MS_NotificationHubConnectionStringMS_TableConnectionStringUnder Connection Strings, copy MS_NotificationHubConnectionString and MS_TableConnectionString. 导航到新的升级站点并粘贴这些值,覆盖任何现有值。Navigate to your new upgrade site and paste them in, overwriting any existing values. 针对应用所需的任何其他应用程序设置重复此过程。Repeat this process for any other application settings your app needs.

为应用程序制作 ASP.NET 项目的副本,并将其发布到新站点。Make a copy of the ASP.NET project for your application and publish it to your new site. 通过使用新 URL 更新的客户端应用程序副本验证一切是否正常工作。Using a copy of your client application updated with the new URL, validate that everything works as expected.

更新服务器项目Updating the server project

移动应用包含一个新的 移动应用服务器 SDK ,该 SDK 提供许多与移动服务运行时相同的功能。Mobile Apps provides a new Mobile App Server SDK which provides much of the same functionality as the Mobile Services runtime. 首先,应该删除对移动服务包的所有引用。First, you should remove all references to the Mobile Services packages. 在 NuGet 包管理器中,搜索 WindowsAzure.MobileServices.BackendIn the NuGet package manager, search for WindowsAzure.MobileServices.Backend. 大多数应用在此处有多个对应的包,包括 WindowsAzure.MobileServices.Backend.TablesWindowsAzure.MobileServices.Backend.EntityMost apps will see several packages here, including WindowsAzure.MobileServices.Backend.Tables and WindowsAzure.MobileServices.Backend.Entity. 在这种情况下,请从依赖性树中级别最低的包(例如 Entity)开始删除包。In such a case, start with the lowest package in the dependency tree, such as Entity, and remove it. 出现提示时,请不要删除所有依赖包。When prompted, do not remove all dependant packages. 重复此过程,直到已删除 WindowsAzure.MobileServices.Backend 本身。Repeat this process until you have removed WindowsAzure.MobileServices.Backend itself.

此时,项目不会再引用移动服务 SDK。At this point you will have a project that no longer references Mobile Services SDKs.

接下来,添加对移动应用 SDK 的引用。Next you will add references the Mobile Apps SDK. 对于这种升级,大多数开发人员都会下载并安装 Microsoft.Azure.Mobile.Server.Quickstart 包,因为这可以提取整个所需集。For this upgrade, most developers will want to download and install the Microsoft.Azure.Mobile.Server.Quickstart package, as this will pull in the entire required set.

到时将有不少因 SDK 之间的差异而发生的编译器错误,但这些错误都很容易处理,本部分的余下内容将予以说明。There will be quite a few compiler errors resulting from differences between the SDKs, but these are easy to address and are covered in the rest of this section.

基本配置Base configuration

然后,在 WebApiConfig.cs 中,将:Then, in WebApiConfig.cs, you can replace:

// Use this class to set configuration options for your mobile service
ConfigOptions options = new ConfigOptions();

    // Use this class to set WebAPI configuration options
    HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

替换为with

HttpConfiguration config = new HttpConfiguration();
new MobileAppConfiguration()
    .UseDefaultConfiguration()
.ApplyTo(config);

Note

如果想要详细了解新的 .NET 服务器 SDK 以及如何在应用中添加/删除功能,请参阅 如何使用 .NET 服务器 SDK 主题。If you wish to learn more about the new .NET server SDK and how to add/remove features from your app, please see the How to use the .NET server SDK topic.

如果应用使用身份验证功能,则还需要注册 OWIN 中间件。If your app makes use of the authentication features, you will also need to register an OWIN middleware. 在此情况下,应该将上述配置代码移入新的 OWIN 启动类。In this case, you should move the above configuration code into a new OWIN Startup class.

  1. 如果 NuGet 包 Microsoft.Owin.Host.SystemWeb 尚未包含在项目中,请添加该包。Add the NuGet package Microsoft.Owin.Host.SystemWeb if it is not already included in your project.
  2. 在 Visual Studio 中,右键单击项目,然后选择“添加” -> “新建项”。In Visual Studio, right click on your project and select Add -> New Item. 选择“Web” -> “常规” -> “OWIN 启动类”。Select Web -> General -> OWIN Startup class.
  3. 将 MobileAppConfiguration 的上述代码从 WebApiConfig.Register() 移到新启动类的 Configuration() 方法。Move the above code for MobileAppConfiguration from WebApiConfig.Register() to the Configuration() method of your new startup class.

确保 Configuration() 方法的末尾为:Make sure the Configuration() method ends with:

app.UseWebApi(config)
app.UseAppServiceAuthentication(config);

存在其他一些与身份验证相关的更改,下面的完全身份验证部分介绍这些内容。There are additional changes related to authentication which are covered in the full authentication section below.

处理数据Working with Data

在移动服务中,移动应用名称用作 Entity Framework 设置中的默认架构名称。In Mobile Services, the mobile app name served as the default schema name in the Entity Framework setup.

若要确保架构与以前引用的一样,请使用以下代码设置 DbContext 中适用于应用程序的架构:To ensure that you have the same schema being referenced as before, use the following to set the schema in the DbContext for your application:

string schema = System.Configuration.ConfigurationManager.AppSettings.Get("MS_MobileServiceName");

如果执行上述操作,请确保设置 MS_MobileServiceName。Please make sure you have MS_MobileServiceName set if you do the above. 如果应用程序以前已自定义此架构,则也可以提供其他架构名称。You can also provide another schema name if your application customized this previously.

系统属性System Properties

命名Naming

在 Azure 移动服务服务器 SDK 中,系统属性始终包含属性的双下划线 (__) 前缀:In the Azure Mobile Services server SDK, system properties always contain a double underscore (__) prefix for the properties:

  • __createdAt__createdAt
  • __updatedAt__updatedAt
  • __deleted__deleted
  • __version__version

移动服务客户端 SDK 具有特殊的逻辑用于分析这种格式的系统属性。The Mobile Services client SDKs have special logic for parsing system properties in this format.

在 Azure 移动应用中,系统属性不再使用特殊格式,而是使用以下名称:In Azure Mobile Apps, system properties no longer have a special format and have the following names:

  • createdAtcreatedAt
  • updatedAtupdatedAt
  • deleteddeleted
  • 版本version

移动应用客户端 SDK 使用新系统属性名称,因此不需要对客户端代码进行任何更改。The Mobile Apps client SDKs use the new system properties names, so no changes are required to client code. 但是,如果要直接对服务进行 REST 调用,则应该相应地更改查询。However, if you are directly making REST calls to your service then you should change your queries accordingly.

本地存储Local store

更改系统属性的名称意味着用于移动服务的脱机同步本地数据库与移动应用不兼容。The changes to the names of system properties mean that an offline sync local database for Mobile Services is not compatible with Mobile Apps. 在将挂起的更改发送到服务器之前,应尽可能避免将客户端应用从移动服务升级到移动应用。If possible, you should avoid upgrading client apps from Mobile Services to Mobile Apps until after pending changes have been sent to the server. 然后,升级的应用应使用新的数据库文件名。Then, the upgraded app should use a new database filename.

如果客户端应用是从移动服务升级到移动应用,但同时在操作队列中有挂起的脱机更改,则系统数据库必须更新才能使用新的列名。If a client app is upgraded from Mobile Services to Mobile Apps while there are pending offline changes in the operation queue, then the system database must be updated to use the new column names. 在 iOS 上,可以使用轻量迁移更改列名,从而做到这一点。On iOS, this can be achieved using lightweight migrations to change the column names. 在 Android 和 .NET 托管客户端上,应该编写自定义 SQL 来重命名数据对象表的列。On Android and the .NET managed client, you should write custom SQL to rename the columns for your data object tables.

在 iOS 上,应该根据以下列表更改数据实体的核心数据架构。On iOS, you should change your Core Data schema for your data entities to match the following. 请注意,属性 createdAtupdatedAtversion 不再有 ms_ 前缀:Note that the properties createdAt, updatedAt and version no longer have an ms_ prefix:

属性Attribute 类型Type 注意Note
idid 字符串(标记为必需)String, marked required 远程存储中的主键primary key in remote store
createdAtcreatedAt 日期Date (可选)映射到 createdAt 系统属性(optional) maps to createdAt system property
updatedAtupdatedAt 日期Date (可选)映射到 updatedAt 系统属性(optional) maps to updatedAt system property
版本version StringString (可选)用于检测冲突,映射到版本(optional) used to detect conflicts, maps to version

查询系统属性Querying system properties

在 Azure 移动服务中,默认不会发送系统属性,而是仅当使用查询字符串 __systemProperties请求时才发送系统属性。In Azure Mobile Services, system properties are not sent by default, but only when they are requested using the query string __systemProperties. 相反,在 Azure 移动应用中, 始终会选择 系统属性,因为它们是服务器 SDK 对象模型的一部分。In contrast, in Azure Mobile Apps system properties are always selected since they are part of the server SDK object model.

此项更改主要影响域管理器的自定义实现,例如 MappedEntityDomainManager的扩展。This change mainly impacts custom implementations of domain managers, such as extensions of MappedEntityDomainManager. 在移动服务中,如果客户端永远不请求任何系统属性,则可以使用 MappedEntityDomainManager ,它实际上不会映射所有属性。In Mobile Services, if a client never requests any system properties, it is possible to use a MappedEntityDomainManager that does not actually map all properties. 但是,在 Azure 移动应用中,这些未映射的属性会导致 GET 查询出错。However, in Azure Mobile Apps, these unmapped properties will cause an error in GET queries.

解决此问题的最简单方法是修改 DTO,使它们继承自 ITableData 而不是 EntityDataThe easiest way to resolve the issue is to modify your DTOs so that they inherit from ITableData instead of EntityData. 然后,将 [NotMapped] 属性添加到应省略的字段。Then, add the [NotMapped] attribute to the fields that should be omitted.

例如,以下示例定义 TodoItem 且不使用任何系统属性:For example, the following defines TodoItem with no system properties:

using System.ComponentModel.DataAnnotations.Schema;

public class TodoItem : ITableData
{
    public string Text { get; set; }

    public bool Complete { get; set; }

    public string Id { get; set; }

    [NotMapped]
    public DateTimeOffset? CreatedAt { get; set; }

    [NotMapped]
    public DateTimeOffset? UpdatedAt { get; set; }

    [NotMapped]
    public bool Deleted { get; set; }

    [NotMapped]
    public byte[] Version { get; set; }
}

注意:如果收到有关 NotMapped 的错误,请添加对程序集 System.ComponentModel.DataAnnotations 的引用。Note: if you get errors on NotMapped, add a reference to the assembly System.ComponentModel.DataAnnotations.

CORSCORS

移动服务通过包装 ASP.NET CORS 解决方案,融入了对 CORS 的部分支持。Mobile Services included some support for CORS by wrapping the ASP.NET CORS solution. 此包装层现已删除,使开发人员拥有更多控制权,因此,可以直接利用 ASP.NET CORS 支持This wrapping layer has been removed to give the developer more control, so you can directly leverage ASP.NET CORS support.

使用 CORS 时的主要考虑范畴是,必须允许 eTagLocation 标头,客户端 SDK 才能正常工作。The main areas of concern if using CORS are that the eTag and Location headers must be allowed in order for the client SDKs to work properly.

推送通知Push Notifications

对于推送,可能会发现服务器 SDK 中遗漏的主项是 PushRegistrationHandler 类。For push, the main item that you may find missing from the Server SDK is the PushRegistrationHandler class. 注册在移动应用中的处理方式稍有不同,默认情况下启用不带标记的注册。Registrations are handled slightly differently in Mobile Apps, and tagless registrations are enabled by default. 可以使用自定义 API 实现标记管理。Managing tags may be accomplished by using custom APIs. 有关详细信息,请参阅注册标记说明。Please see the registering for tags instructions for more information.

计划的作业Scheduled Jobs

移动应用中未内置计划的作业,因此在 .NET 后端中的任何现有作业都必须单独升级。Scheduled jobs are not built into Mobile Apps, so any existing jobs that you have in your .NET backend will need to be upgraded individually. 一种做法是在移动应用代码站点上创建计划的 Web 作业One option is to create a scheduled Web Job on the Mobile App code site. 也可以设置用于保存作业代码的控制器,并设置按预期计划在终结点上运行的 Azure 计划程序You could also set up a controller that holds your job code and configure the Azure Scheduler to hit that endpoint on the expected schedule.

其他更改Miscellaneous changes

移动客户端要使用的所有 ApiControllers 现在必须具有 [MobileAppController] 属性。All ApiControllers which will be consumed by a mobile client must now have the [MobileAppController] attribute. 默认不再包含此属性,因此,其他 ApiControllers 不受移动格式化程序的影响。This is no longer included by default so that other ApiControllers to go unaffected by the mobile formatters.

ApiServices 对象不再是 SDK 的一部分。The ApiServices object is no longer part of the SDK. 若要访问移动应用设置,可以使用以下代码:To access Mobile App settings, you can use the following:

MobileAppSettingsDictionary settings = this.Configuration.GetMobileAppSettingsProvider().GetMobileAppSettings();

同样,现在可以使用标准的 ASP.NET 跟踪写入实现日志记录:Similarly, logging is now accomplished using the standard ASP.NET trace writing:

ITraceWriter traceWriter = this.Configuration.Services.GetTraceWriter();
traceWriter.Info("Hello, World");  

身份验证注意事项Authentication considerations

移动服务的身份验证组件现已移入应用服务身份验证/授权功能。The authentication components of Mobile Services have now been moved into the App Service Authentication/Authorization feature. 可以阅读向移动应用添加身份验证主题,了解如何为站点启用此功能。You can learn about enabling this for your site by reading the Add authentication to your mobile app topic.

对于某些提供程序(例如 AAD 和百度),应该可以利用复制应用程序的现有注册。For some providers, such as AAD, you should be able to leverage the existing registration from your copy application. 只需导航到标识提供者的门户,并将新的重定向 URL 添加到注册即可。You simply need to navigate to the identity provider's portal and add a new redirect URL to the registration. 然后,使用客户端 ID 和机密配置应用服务身份验证/授权。Then configure App Service Authentication/Authorization with the client ID and secret.

控制器操作授权Controller action authorization

现在,必须更改 [AuthorizeLevel(AuthorizationLevel.User)] 属性的所有实例才能使用标准的 ASP.NET [Authorize] 属性。Any instances of the [AuthorizeLevel(AuthorizationLevel.User)] attribute must now be changed to use the standard ASP.NET [Authorize] attribute. 此外,默认情况下,控制器现在是匿名的,如同在其他 ASP.NET 应用程序中一样。Additionally, controllers are now Anonymous by default, as in other ASP.NET applications. 如果以前一直在使用其他某个 AuthorizeLevel 选项(例如 Admin 或 Application),请注意,现在这些选项都不再存在。If you were using one of the other AuthorizeLevel options, such as Admin or Application, please note that these are gone. 可以改为设置共享机密的 AuthorizationFilters,或者配置 AAD 服务主体,安全启用服务到服务的调用。You can instead set up AuthorizationFilters for shared secrets or configure an AAD Service Principal to enable service-to-service calls securely.

获取其他用户信息Getting additional user information

可以获取其他用户信息,包括通过 GetAppServiceIdentityAsync() 方法访问令牌:You can get additional user information, including access tokens through the GetAppServiceIdentityAsync() method:

    MicrosoftCredentials creds = await this.User.GetAppServiceIdentityAsync<MicrosoftCredentials>();

此外,如果应用程序依赖于用户 ID(例如,将它们存储在数据库中),请务必注意,移动服务与应用服务移动应用之间的用户 ID 是不相同的。Additionally, if your application takes dependencies on user IDs, such as storing them in a database, it is important to note that the user IDs between Mobile Services and App Service Mobile Apps are different. 但是,仍然可以获取移动服务用户 ID。You can still get the Mobile Services User ID, though. 所有 ProviderCredentials 子类具有 UserId 属性。All of the ProviderCredentials subclasses have a UserId property. 继续分析前面的示例:So continuing from the example before:

string mobileServicesUserId = creds.Provider + ":" + creds.UserId;

如果应用程序依赖于用户 ID,必须尽可能使用相同的标识提供者注册。If your app does take any dependencies on user IDs, it is important that you leverage the same registration with an identity provider if possible. 用户 ID 的范围通常限定在已使用的应用程序注册,因此引入新的注册可能会让用户在匹配其数据时发生问题。User IDs are typically scoped to the application registration that was used, so introducing a new registration could create problems with matching users to their data.

自定义身份验证Custom authentication

如果应用程序使用自定义的身份验证解决方案,需要确保已升级的站点有权访问系统。If your app is using a custom authentication solution, you will want to make sure that the upgraded site has access to the system. 遵循 .NET 服务器 SDK 概述 中适用于自定义身份验证的新说明来集成解决方案。Follow the new instructions for custom authentication in the .NET server SDK overview to integrate your solution. 请注意,自定义身份验证组件仍以预览版提供。Please note that the custom authentication components are still in preview.

更新客户端Updating clients

在获得可正常运行的移动应用后端之后,可以在使用它的新版客户端应用程序上操作。Once you have an operational Mobile App backend, you can work on a new version of your client application which consumes it. 移动应用还包含新版客户端 SDK。与上述服务器升级类似,需先删除对移动服务 SDK 的所有引用,然后再安装移动应用版本。Mobile Apps also includes a new version of the client SDKs, and similar to the server upgrade above, you will need to remove all references to the Mobile Services SDKs before installing the Mobile Apps versions.

版本间的其中一个主要更改是构造函数不再需要应用程序密钥。One of the main changes between the versions is that the constructors no longer require an application key. 现在只需传入移动应用的 URL。You now simply pass in the URL of your Mobile App. 例如,在 .NET 客户端中, MobileServiceClient 构造函数现在是:For example, on the .NET clients, the MobileServiceClient constructor is now:

    public static MobileServiceClient MobileService = new MobileServiceClient(
        "https://contoso.chinacloudsites.cn", // URL of the Mobile App
    );

可以通过以下链接,阅读有关安装新 SDK 以及使用新结构的信息:You can read about installing the new SDKs and using the new structure via the links below:

如果应用程序使用推送通知,请记下每个平台的特定注册说明,因为相关的注册也发生了一些更改。If your application makes use of push notifications, make note of the specific registration instructions for each platform, as there have been some changes there as well.

准备好新客户端版本后,请尝试对已升级的服务器项目运行该版本。When you have the new client version ready, try it out against your upgraded server project. 确认该版本正常工作后,可将新版应用程序发布给客户。After validating that it works, you can release a new version of your application to customers. 最后,在客户收到这些更新后,便可以删除应用的移动服务版本。Eventually, once your customers have had a chance to receive these updates, you can delete the Mobile Services version of your app. 现在,已使用最新的移动应用服务器 SDK 完全升级到应用服务移动应用。At this point, you have completely upgraded to an App Service Mobile App using the latest Mobile Apps server SDK.