---
title: "Windows Azure SDK的最新更新-.NET 4.5, Windows Server 2012等"
author: "bk_lin"
date: "2013-01-11T11:09:00Z"
tags: []
slug: "windows-azure-sdk-net-4-5-windows-server-2012"
draft: false
lastmod: "2013-02-02T22:29:29Z"
id: 1785654
url: "https://bk-lin.iteye.com/blog/1785654"
---

**作者信息**：本文由[**Mohit Srivastava**](http://social.msdn.microsoft.com/profile/mohit%20srivastava/) 和 **Dennis Angeline**攥写

[Windows Azure SDK for .NET](http://www.windowsazure.com/en-us/develop/net/?slideshow=5 ".NET - Develop")的最新版本有很多大的功能改进，包括

- .NET4.5 / Windows Server 2012 (OS Family 3）在 Web/Worker Role上获得支持
- VS工具-效率提升
- Web/Worker Role的缓存- General availability
- Storage – 新工具和客户端类库
- Service Bus – 升级的客户端类库和工具

此外，现在[Windows Azure PowerShell (单独下载)](http://www.windowsazure.com/en-us/manage/downloads/)可以支持[Service Bus 命名空间和VHD's上传](http://michaelwasham.com/2012/12/14/new-windows-azure-powershell-update-december-2012/)。所有这些SDK和PowerShell的改进在[Windows Azure .NET Developer Center](http://www.windowsazure.com/en-us/develop/net ".NET Dev Center")上都可用。以下是详细信息：

#### NET 4.5 / Windows Server 2012 (OS Family 3）在 Web/Worker Role上获得支持

在此版本的 SDK中，您就可以在 Windows Server 2012 上运行Cloud Service应用程序。当您选择 Windows Server 2012时，您同时还获得了 IIS 8 和.NET 4.5 的新功能。IIS 8 的 WebSockets可以帮助您构建现代的实时应用程序--如游戏和聊天应用程序—即可以在浏览器又可以在手机上运行。.NET 4.5 包括了ASP.NET一些大的修改，比如在丰富异步功能上、 对WebSockets 的支持上以及在启动时间和内存占用量的功能增强 (达 35%)上。

开始使用 Visual Studio 的这些功能，请首先创建.NET 4.5 Windows Azure Cloud Service：

[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/3716.1.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/3716.1.png)

您的应用程序会自动设置成指向OS Family 3，或者 Windows Server 2012。

[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/4705.2.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/4705.2.png)

如果您已经拥有 OS Family 1 （Windows Server 2008 SP2) 或 OS Family 2 （Windows Server 2008 R2） 项目，您可以重新将它指向 OS Family3 并开始使用 Windows Server 2012。安装好October 2012 SDK后，升级您的项目指向最新的 SDK （在下一节具体介绍）。然后，如上图所示，更改Service Configuration中的 OS Family属性为3。

#### VS工具-效率提升

October SDK的November 2011 和 June 2012 的sdk 版本可以并行安装。您可以安装新的 SDK来在新项目中体验新的功能，但只有当您准备好来升级您的现有项目。

当您准备好后，右键点击 Windows Azure Cloud Service Project，选择Properties，从Application选项卡中选择Upgrade来升级您的项目：  
[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/7510.3.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/7510.3.png)

另外，对于仅安装October SDK的机器，您可以在 Visual Studio弹出框中选择 文件-&gt; 打开来升级您的项目：

[![](http://blogs.msdn.com/resized-image.ashx/__size/350x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/6366.4.png)](http://blogs.msdn.com/resized-image.ashx/__size/350x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/6366.4.png)

您将看到您成功升级的Cloud Service项目的项目属性已显示 为 Windows Azure Tools October 2012版本。  
[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/2311.5.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/2311.5.png)

当您把项目转换好，您也可以将它指向 OS Family 3 （如前一节中所述) 和.NET 4.5。

附加工具的改进包括：

- 支持每个付费会员享有25个管理证书
- 减少上下文切换到门户-您只需从门户网站中导入您的付费信息就可以获得连接字符串并使用Storage 和 Service Bus
- 改进了缓存工具和对Storage 和Service Bus的Server Explorer（详述见下一节）

**Web/Worker Role的缓存- General Availability**

Windows Azure Caching作为 October SDK的一部分嵌入在General Availability。Caching提供了一种以您的角色实例作为缓存集群方式来使用内存的好方法。使用高利用率模式时，辅助副本也同样放置在不同的默认域和升级域上。如果缓存集群中的任意一个虚拟机因某种原因出现故障，缓存集群可以调用其辅助副本以防止数据丢失。

功能包括：

- 预置的 ASP.NET 会话状态和页面输出缓存，不必修改应用程序代码就可以加速web 应用程序。
- 任何可序列化的托管对象都可以缓存-例如：CLR 对象，行、 XML、 二进制数据
- 与Memcached 兼容

从角色的属性页面，您可以为一个Cloud Service启用和配置 Windows Azure 内存分布式的缓存集群。有关完整的详细信息，请参阅Windows Azure Caching。

[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/2425.6.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/2425.6.png)

#### Storge-新工具和客户端类库

Visual Studio Server Explorer提高了对查看和管理 Windows Azure Storage Blobs和Queues的进一步支持。Add New Storage Account对话框就可以列举您的存储帐户，从而免去了从门户网站复制存储连接字符串的必要。

[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/7446.7.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/7446.7.png)

Blob 节点支持上传、 下载、 以及在 Blob上查询添加删除的操作。

[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/0363.8.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/0363.8.png)

Queues节点支持添加消息，出列消息和清除Queues上的队列操作。

[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/1016.9.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/1016.9.png)

此外，Windows Azure Storage Client Library 2.0 版本可通过NuGet下载。它的新功能包括了Table界面的简化、调试的多样性、 Blob 下载续传和异步跨帐户的Copy Blob。完整的详细信息，请参见[关于 Windows Azure 存储客户端库2.0 在.NET 和 Windows Runtime中应用的介绍](/b/windowsazurestorage/archive/2012/10/29/introducing-windows-azure-storage-client-library-2-0-for-net-and-windows-runtime.aspx)。

由于类库做了大的改动，Windows Azure Diagnostics目前依赖于Storage Client 1.7， Cloud Services项目在 Visual Studio中可继续使用Storage Client 1.7。但是，由于程序集名称已更改，您可以在添加Storage Client 2.0的同时也使用Add Referenc（使用 NuGet来取代assembly）。有关变化和改动详细的列表，请参阅[Windows Azure Storage Client Library 2.0 Breaking Changes & Migration Guide](/b/windowsazurestorage/archive/2012/10/29/windows-azure-storage-client-library-2-0-breaking-changes-amp-migration-guide.aspx)。

#### Service Bus -升级的客户端类库和工具

Service Bus客户端库已经更新至1.8 版本，它的新功能更易于用户构建具有丰富消息传递的应用程序。您现在可以使用[自动转发](http://msdn.microsoft.com/en-us/library/jj687471.aspx)来连接Queue和Topics。这样可以让您标出Topics，或者集合多个Queues的消息到一个Queues。另外，更新实体也引入了新方法，那就是查询实体和续订消息锁现在也可用了。有关完整的详细信息，请参阅[Service Bus October 2012的发布说明](http://msdn.microsoft.com/en-us/library/jj737688.aspx)。

随着Storage的应用，现在您可以用导入会员信息的Service Bus tooling设置和导入命名空间，而不需额外的门户网站信息：

[![](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/8345.10.png)](http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/8345.10.png)

一旦选择了一个命名空间，您可以创建、 删除测试消息并把它发送到Queues and Topics。新的 SDK 版本中，您可以更新您已有的Queues and Topics并在应用程序行为方面改变设置以此来测试对您程序有什么影响：

[![](http://blogs.msdn.com/resized-image.ashx/__size/350x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/5518.11.png)](http://blogs.msdn.com/resized-image.ashx/__size/350x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-13-25/5518.11.png)

**总结**

上面所提及的增加的功能在[Windows Azure SDK for .NET](http://www.windowsazure.com/en-us/develop/net/?slideshow=5) October版本上都可找到并且这只是它功能的一部分。如果您还没有 Windows Azure 的账户，今天可以注册一个[免费试用版](https://www.windowsazure.com/en-us/pricing/free-trial/)来构建您的 Windows Azure .NET 应用程序。想了解更多请访问[Windows Azure .NET Developer Center](http://www.windowsazure.com/en-us/develop/net/)。

在接下来的文章中，我们将讨论Windows Azure PowerShell 最近更新。详细信息请留心关注我们的博客。

希望这些能帮助到您，

Windows Azure SDK Team

本文翻译自：[http://blogs.msdn.com/b/windowsazure/archive/2013/01/08/recent-updates-to-the-windows-azure-sdk-net-4-5-windows-server-2012-and-more.aspx](/b/windowsazure/archive/2013/01/08/recent-updates-to-the-windows-azure-sdk-net-4-5-windows-server-2012-and-more.aspx)