在禁用远程桌面连接后,我正在处理一个奇怪的azure问题。我开始从azure sdk 1.2升级到1.4,并启用了远程桌面以便于调试。但是,一旦我完成了升级,并且在部署时一切正常,我就在禁用远程桌面连接的情况下进行了最后一次部署。令我惊讶的是,我的web角色实例被困在“等待角色开始”阶段。有趣的是,工作角色实例正常启动。大约20次部署之后,问题100%可重现:
启用远程桌面:一切正常
禁用远程桌面:无法启动Web角色实例
启用IntelliTrace似乎没有帮助,因为尝试获取日志会导致“没有可用的IntelliTrace日志”错误。如所料,我的源代码管理工具显示启用和禁用远程桌面的唯一区别在于服务定义和配置文件(.cscfg,.csdef)。重新映像和重新启动vms似乎也没有任何好处。
拜托,如果有人有类似的问题,帮助一个绝望的家伙!
更新:以下是服务定义和配置文件:
服务定义.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>

服务配置.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>

最佳答案

终于找到了罪犯,感谢Stevesmarx的评论:)谢谢你们!你让我往正确的方向挖。
原来我的启动任务启动的powershell脚本使用的是Microsoft.Windowsazure.ServiceRuntime管理单元,正如smarx所述,该管理单元是在启用远程桌面连接时随RemoteAccess模块悄悄添加的。这个微妙的包含让我忽略了对管理单元的依赖性,因此我更头疼。
在发现问题后,我实际上看到我甚至不需要管理单元,因此解决方案是从我的powershell脚本中删除add pssnapin microsoft.windowsazure.serviceuruntime调用。如果我真的需要这个管理单元,this文章展示了一种在使用它之前安装管理单元的方法,因为默认情况下它不会安装在azure vms上。
另一个帮助我调试启动任务的有用资源是this articlebysmarx
希望这能让我在这个问题上失去的时间都省下来。再次感谢Stevesmarx

关于windows - 如何修复此Azure错误:禁用远程桌面连接后,Web角色无法启动?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6573061/

10-10 05:05