《Windows Azure Platform 系列文章目录》

让我们再回顾一下Windows Azure Startup Task

<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"><WebRole name="WebRole1"><Startup><Task commandLine="Startup.cmd" executionContext="limited" taskType="simple"></Task></Startup></WebRole></ServiceDefinition>

  在以上代码中,最核心的就是Startup.cmd,这个cmd可以是PowerShell scripts。在这个cmd文件中你可以执行您自己的逻辑,比如

-  注册一个dll(regsvr32..)

-  注册一个Windows Service (InstallUtil..)

-  其他PowerShell scripts (比如安装其他第三方的组件,如Crystal Report)

  为什么我们需要Startup Task呢?

  我们知道,Windows Azure VM是非持久性的。在某些异常情况下(比如断电,硬件故障等),某个正常工作的Azure VM会宕机而无法正常使用。后台的Windows Azure Fabric Controller会自动把该VM上的Azure Apps迁移到同一数据中心的另外一台正常的计算节点之上,保证服务的持久性和健壮性。

  如果没有StartUp Task,那在Fabric Controller迁移之后,Azure Apps管理员不得不远程登录到新的VM上,然后手工执行regsvr32命令。否则Azure Apps无法正常运行(的确,因为在新的Azure VM上没有注册COM组件)。但这样岂不是非常麻烦:迁移之后还需要人工来注册,不能实现自动化。

  有了Startup Task功能会在系统迁移、故障恢复的时候自动执行命令,因此每次修改都是持久性的,不需要人为干预操作。

  如果大家对Startup Lifecycle (Startup 生命周期)感兴趣的,可以参考这篇文章 《Real World : Startup Lifecycle of a Windows Azure Role》http://msdn.microsoft.com/en-us/library/windowsazure/hh127476.aspx

Windows Azure Cloud Service (25) 使用Startup注册COM组件(下)相关推荐

  1. Windows Azure Cloud Service (39) 如何将现有Web应用迁移到Azure PaaS平台

    <Windows Azure Platform 系列文章目录> 本文将简单介绍,如何将企业内现有的ASP.NET应用程序迁移到Azure PaaS平台. 因为在迁移过程中,可能需要对现有的 ...

  2. [New Portal]Windows Azure Cloud Service (33) 使用Visual Studio 2012 部署Cloud Service

    <Windows Azure Platform 系列文章目录> 笔者已经将工作用的笔记本电脑升级到Windows 8很长一段时间了,开发工具也从Visual Studio 2010升级到了 ...

  3. Windows Azure Cloud Service (17) Role Endpoint

    <Windows Azure Platform 系列文章目录> 在Windows Azure平台中,用户最多可以对以个Role指定5个Endpoint.而一个Hosted Service最 ...

  4. Windows Azure Cloud Service (23) 使用Full IIS模式部署多站点和虚拟目录

    <Windows Azure Platform 系列文章目录> 本章我们将介绍如何使用Windows Azure的Full IIS模式部署多站点和虚拟目录. 首先我们先新建一个Window ...

  5. Windows Azure Cloud Service (24) 在模拟器中运行时跳过Windows Azure Startup任务

    <Windows Azure Platform 系列文章目录> 前一章里我们已经介绍了如何使用Windows Azure Startup来执行额外的配置任务,比如注册COM组件和注册Win ...

  6. Windows Azure Cloud Service (27) 在Windows Azure发送邮件(上)

    <Windows Azure Platform 系列文章目录> 许多Web应用都具有发送邮件通知的功能,不管是作为用户注册流程的一部分,还是通知用户一系列重要事件的发生.如果您是一个.NE ...

  7. Windows Azure Cloud Service (41) 修改云服务IIS托管管道模式为4.0经典模式

    <Windows Azure Platform 系列文章目录> 这是笔者在之前的项目中遇到的问题,做一下总结,给网友做参考. 在一般情况下,Visual Studio开发的Cloud Se ...

  8. Windows Azure Cloud Service (1) 用户手册

    <Windows Azure Platform 系列文章目录> 下载地址 Cloud Service用户手册

  9. Windows Azure Cloud Service (19) 动态指定WCF的发布地址

    <Windows Azure Platform 系列文章目录> 在刚才的例子中,服务端和客户端都是通过配置文件明确指定了WCF的地址,而如果现在需要将此服务发布到别的Hosted Serv ...

  10. Windows Azure Cloud Service (8) Role及其生命周期模型

    <Windows Azure Platform 系列文章目录> 我们浏览Windows Azure项目.如下图所示 可以看到Windows Azure的项目包含传统的ASP.NET工程文件 ...

最新文章

  1. 面试大法——算法、Python、机器学习等笔试面经资源|干货收藏
  2. 进程隐藏工具hidetoolz源码_linux最好用的资源监控工具-glances
  3. CVPR2017有哪些值得读的Image Caption论文?
  4. li或dd 浮动后增加图片时高度多出3-5px的问题
  5. JavaScript设计模式 Item 3 --封装
  6. Oracle的数据字典常用操作(持续更新)
  7. sis 最新_《炙热的我们》火箭少女首胜,sis姐妹花遭遇惨败出局?
  8. (实用软件分享)屏幕取色器ColorPix
  9. 瑞丽超级排料的使用非常简单 超级排料系统2012超越版
  10. docker命令总结(二)
  11. intel hd3000 本 在 64位 ubuntu10.04 下 液晶亮度无法调节 的解决之道(亲测)
  12. DSP芯片的基本结构
  13. python-科研绘图系列(7)-箱型图(盒型图)
  14. Unity3D研究院之静态自动检查代码缺陷与隐患
  15. android多个单选按钮互斥使用,在android中使用RadioButton时,要想实现互斥
  16. Vue使用WebUploader上传文件/压缩包
  17. android刷机恢复出厂设置吗,安卓手机恢复出厂设置和双清有什么区别?
  18. [ 热题 HOT 100] ---15.三数之和---排序+双指针
  19. 【慕伏白教程】《动手学深度学习》学习环境安装流程
  20. PLC是怎么控制伺服电机的?又该如何设计一个伺服系统?

热门文章

  1. python期末考试及答案单引号、双引号和三引号_python脚本中单引号’ 双引号“ 三个单引号‘’‘ 三个双引号”“” 差别 及反斜杠的用法...
  2. 小程序会话服务器,完美解决小程序session问题
  3. java class getfields_JAVA反射中的getFields()方法和getDeclaredFields ()方法的区别
  4. java http下载_java http下载文件
  5. Jupyter notebook:如何切换Python环境
  6. 计算机网络—4运输层(TCP连接管理、流量控制、拥塞控制)
  7. DSP实验二c语言程序,实验1.2:编写一个以C语言为基础的DSP程序
  8. php 怎么写配置文件,在PHP中如何把数组写成配置文件
  9. mysql event查询_Mysql中Event的一些测试
  10. 判断闰年的c语言程序_身为程序员还记得C语言经典算法(附带答案)吗?