2

我一直在观看构建会议上的一些视频:Inside Windows Azure 等。我从中得到的收获是,除非我将预配置的 VHD 加载到虚拟机角色中,否则我会丢失我可能拥有的任何系统设置如果实例被关闭或回收,则制作。

例如,我有一个帐户,其中有 2 个 Web 角色,运行多个(小)网站。为此,我必须调整 Hosts 文件中的设置。我知道我的网站在发生故障时会被转移,因为它们是在 ServiceConfiguration.csfg 中定义的,但是如果发生故障,我的主机文件设置也会转移到新的实例吗?

即我的网络角色“模板”有多深/全面?

4

3 回答 3

2

The hosts file will be reconstructed on any full redeployment or reimage.

In general, you should avoid relying on changes to any file that is created by the operating system. If your application is migrated to another server it will be running on a new virtual machine with its own new copy of Windows, and so the changes will suddenly appear to have vanished.

The same will happen if you perform a deployment to the Azure "staging" environment and then perform a "swap VIP": the "staging" environment will not have the changes made to the operating system file.

Microsoft intentionally don't publish inner details of what Azure images look like as they will most likely change in future, but currently

  • drive C: holds the boot partition, logs, temporary data and is small
  • drive D: holds a Windows image
  • drive E: or F: holds your application

On a full deployment, or a re-image, you receive a new virtual machine so all three drives are re-created. On an upgrade, the virtual machine continues to run but the load balancer migrates traffic away while the new version of the application is deployed to drive F:. Drive E: is then removed.

So, answering your question directly, the "template" is for drive E: -- anything else is subject to change without your knowledge, and can't be relied on.

于 2011-10-02T23:46:37.093 回答
1

现有答案在技术上是正确的并回答了问题,但在单个 Web 角色中托管多个网站根本不需要编辑主机文件。只需在您的 ServiceDefinition.csdef 中定义多个网站(具有不同的主机标头)。请参阅http://msdn.microsoft.com/en-us/library/gg433110.aspx

于 2011-10-03T22:10:05.103 回答
1

Azure 提供启动脚本,以便您可以在实例启动时进行配置更改。这些通常用于安装额外的操作系统组件或进行 IIS 配置更改(如禁用空闲超时)。

请参阅http://blogs.msdn.com/b/lucascan/archive/2011/09/30/using-a-windows-azure-startup-script-to-prevent-your-site-from-being-shutdown.aspx例如。

于 2011-10-03T00:09:42.477 回答