如何修复此Azure错误:禁用远程桌面连接后无法启动Web角色?

时间:2011-07-04 14:53:34

标签: windows azure

在禁用远程桌面连接后,我正在努力解决一个奇怪的Azure问题。我开始从Azure SDK 1.2升级到1.4并启用了远程桌面以便于调试。但是,一旦我完成升级并且部署后一切运行顺利,我做了一个最终部署,禁用了远程桌面连接。令我惊讶的是,我的网络角色实例停留在“ 等待角色开始 ”阶段。有趣的是,工作者角色实例正常启动。大约20个部署后来问题是100%可重现:

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

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

如果有人有类似的问题,请帮助一个绝望的家伙!

UPDATE:以下是服务定义和配置文件:

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>

1 个答案:

答案 0 :(得分:5)

最后发现罪魁祸首归功于Stevesmarx的评论:)谢谢大家!你让我在正确的方向上挖掘。

我的启动任务触发的PowerShell脚本使用了 Microsoft.WindowsAzure.ServiceRuntime 管理单元,正如smarx所述,在远程时远程添加了RemoteAccess模块桌面连接已启用。而这种微妙的包含让我忽略了对snapin的依赖,因此我的进一步头痛。

找到问题后,我实际上看到我甚至不需要snapin,因此解决方案是从我的PowerShell脚本中删除 Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime 调用。如果我真的需要snapin,this文章显示了一种在使用snapin之前安装snapin的方法,因为默认情况下它不会安装在Azure VM上。

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

希望这会让我失去这个问题的所有时间。再次感谢您Stevesmarx