Windows Azure Platform 系列文章目录

  

  OK,前几章我们已经在VHD里安装了Windows Server 2008 R2操作系统,并且还安装了.NET Framework 3.5和IIS。最后成功的将VHD上传到Windows Azure位于香港的数据中心里。

  现在OS、Middleware和Runtime都准备好了,但我们还缺少web应用让用户浏览和使用。那让我们开始本章的内容吧!

  因为VM Role还处在Beta阶段,所以如果想在VS2010中使用New Virtual Machine Role,请下载注册表文件并安装

  64bit的操作系统请下载这个

  32bit的操作系统请下载这个

  

  1.首先以管理员方式运行Visual Studio 2010。

  2.创建一个Windows Azure Project,命名为MyVMRole

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  3.在New Windows Azure Project里,不要选择任何Web Role和Worker Role

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  4.在Solution里,Roles右键-->Add-->New Virtual Machine Role

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  5.在Windows Azure Subscription credentials里,配置Windows Azure的证书。

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  关于配置证书的具体步骤,可以参考这篇Windows
Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

   6.正确配置完Windows Azure Subscription credentials之后,我们就可以选择到之前上传的baseimage.vhd了

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  7.为了能够让外部连接通过网络访问VM Role,我们需要配置endpoints。切换到Endpoint选项,然后选择Add Endpoints添加,具体内容如下图

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

   8.然后我们直接发布这个Azure Project

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  9.在Settings-->Hosted service里,我们选择Create New

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  注意:上图我勾选了Enable Remote Desktop for all roles,即可以通过Azure Portal管理界面通过远程桌面连接(Remote Deskop)连接Windows Azure计算节点;配置完成后,原本通过Hyper-V在VHD中配置的管理员用户名和密码将失效;用户名密码将以我在VS2010配置的为准!

  10.创建一个新的Host Service,命名为LeiVMRole,Location在East Asia即香港

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  11.接下来就用VS2010直接发布吧 :)

  12.发布结束后我们可以查看发布成功的URL

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

  13.默认的IIS就是80端口,我们可以看到VHD里IIS7欢迎界面

  这时候我们访问的leivmrole的站点,指向的就是之前我们上传的VHD的80端口的内容。

  Windows Azure VM Role (7) 创建服务
    




Windows Azure Platform 系列文章目录
Windows Azure Platform (十八)用Visual Studio将应用程序部署到Windows Azure平台

 

相关文章: