【问题标题】:How to fix this Azure bug: web role unable to start after disabling remote desktop connections?如何修复此 Azure 错误:禁用远程桌面连接后 Web 角色无法启动?
【发布时间】:2011-07-05 22:40:01
【问题描述】:

禁用远程桌面连接后,我遇到了一个奇怪的 Azure 问题。我开始从 Azure SDK 1.2 升级到 1.4,并启用了远程桌面以便于调试。但是,一旦我完成升级并且部署时一切都运行顺利,我在禁用远程桌面连接的情况下进行了最后一次部署。令我惊讶的是,我的网络角色实例陷入了“等待角色开始”阶段。有趣的是,worker 角色实例正常启动。大约 20 次部署后,问题 100% 可重现:

  • 启用远程桌面:一切正常
  • 远程桌面已禁用:Web 角色实例无法启动

启用 Intellitrace 似乎没有帮助,因为尝试获取日志会导致“没有可用的 IntelliTrace 日志”错误。正如预期的那样,我的源代码控制工具显示启用和禁用远程桌面的唯一区别在于服务定义和配置文件(.cscfg、.csdef)。重新映像和重新启动 VM 似乎也没有任何好处。

如果有人遇到过类似的问题,请帮助一个绝望的人!

更新:这里是服务定义和配置文件:

ServiceDefinition.csdef

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="####" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name="####.Web" enableNativeCodeExecution="true">
    <Runtime executionContext="elevated" />
    <Startup>
      <Task commandLine="StartupTasks\FixACLs.cmd" executionContext="elevated" />
    </Startup>
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="HttpIn" endpointName="HttpIn" />
        </Bindings>
      </Site>
    </Sites>
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" />
    </ConfigurationSettings>
    <LocalResources>
      <LocalStorage name="Index" cleanOnRoleRecycle="false" sizeInMB="10240" />
    </LocalResources>
    <Endpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="80" />
    </Endpoints>

    <!-- BEGIN Remote desktop addition -->
    <Imports>
      <Import moduleName="RemoteAccess" />
    </Imports>
    <!-- END Remote desktop addition -->

  </WebRole>
  <WorkerRole name="####.Worker" enableNativeCodeExecution="true">
    <Runtime executionContext="elevated" />
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" />
    </ConfigurationSettings>
    <LocalResources>
      <LocalStorage name="Index" cleanOnRoleRecycle="true" sizeInMB="10240" />
    </LocalResources>

    <!-- BEGIN Remote desktop addition -->
    <Imports>
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
    </Imports>
    <!-- END Remote desktop addition -->

  </WorkerRole>
</ServiceDefinition>

ServiceConfiguration.cscfg

<?xml version="1.0"?>
<ServiceConfiguration serviceName="####" osFamily="2" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
  <Role name="####.Web">
    <Instances count="2" />
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" value="DefaultEndpointsProtocol=https;AccountName=####;AccountKey=####" />

      <!-- BEGIN Remote desktop addition -->
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="####" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="####" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="####" />
      <!-- END Remote desktop addition -->

    </ConfigurationSettings>

    <!-- BEGIN Remote desktop addition -->
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="####" thumbprintAlgorithm="sha1" />
    </Certificates>
    <!-- END Remote desktop addition -->

  </Role>
  <Role name="####.Worker">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" value="DefaultEndpointsProtocol=https;AccountName=####;AccountKey=####" />

      <!-- BEGIN Remote desktop addition -->
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="####" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="####" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="####" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
      <!-- END Remote desktop addition -->

    </ConfigurationSettings>

    <!-- BEGIN Remote desktop addition -->
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="####" thumbprintAlgorithm="sha1" />
    </Certificates>
    <!-- END Remote desktop addition -->

  </Role>
</ServiceConfiguration>

【问题讨论】:

  • 请贴出两个日志(新旧)的区别。
  • @Steve 编辑了问题以包含这两个文件。
  • Hrm... 如果您只是将[...]RemoteAccess.Enabled" value="true" 设置为"false",您还会遇到同样的问题吗? Azure 技术支持一直对我很好。我不得不打了两次电话,他们两次都帮了我……不收费。
  • 你能给我们看看 FixACLs.cmd 吗?它使用 PowerShell 吗?远程桌面添加了一个 PowerShell 管理单元,我猜 FixACLs 使用它。

标签: windows azure


【解决方案1】:

感谢Stevesmarx的cmets,终于找到了罪魁祸首:)谢谢大家!你让我找到了正确的方向。

原来我的启动任务触发的 PowerShell 脚本使用了 Microsoft.WindowsAzure.ServiceRuntime 管理单元,正如 smarx 所指出的,当远程桌面连接时,它被悄悄地添加到 RemoteAccess 模块中被启用。这种微妙的包含让我忽略了对 snapin 的依赖,因此我更加头疼。

发现问题后,我发现我什至不需要管理单元,因此解决方案是从我的 PowerShell 脚本中删除 Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime 调用。如果我真的需要 snapin,this 文章展示了一种在使用前安装 snapin 的方法,因为它默认不安装在 Azure VM 上。

另一个帮助我调试启动任务的有用资源是this article by smarx

希望这能避免我因这个问题而迷失的所有时间。再次感谢Stevesmarx

【讨论】:

    猜你喜欢
    • 2013-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-11
    相关资源
    最近更新 更多