XML请求正文:在Windows Azure上无效

时间:2013-07-28 05:33:54

标签: xml azure virtual-machine provisioning

  <PersistentVMRole xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <RoleName>SomeName</RoleName>
      <RoleType>PersistentVMRole</RoleType>
      <ConfigurationSets>
        <!--Include either a WindowsProvisioningConfigurationSet or a LinuxProvisioningConfigurationSet, but not both -->
        <ConfigurationSet>
          <ConfigurationType>WindowsProvisioningConfiguration</ConfigurationType>
          <ComputerName>cedvill00</ComputerName>
          <AdminPassword>MyPassword!</AdminPassword>
          <EnableAutomaticUpdates>true</EnableAutomaticUpdates>
          <TimeZone></TimeZone>
          <DomainJoin>
            <Credentials>
              <Username>user-name-in-the-domain</Username>
              <Password>password-for-the-user-name</Password>
            </Credentials>
            <JoinDomain></JoinDomain>
            <MachineObjectOU></MachineObjectOU>
          </DomainJoin>
          <StoredCertificateSettings>
            <CertificateSetting>
              <StoreLocation>LocalMachine</StoreLocation>
              <StoreName>teststorageaccounts</StoreName>
              <Thumbprint>DD3914C952CAC255C1CB15D5A0A35C3C3D008FCC</Thumbprint>
            </CertificateSetting>
          </StoredCertificateSettings>
          <WinRm>
            <Listeners>
              <Listener>
                <Type>Http</Type>
              </Listener>
              <Listener>
                <Type>Https</Type>
              </Listener>
            </Listeners>
          </WinRm>
          <AdminUsername>Cedvill00112233!</AdminUsername>
        </ConfigurationSet>
        <!--<ConfigurationSet>
          <ConfigurationType>LinuxProvisioningConfiguration</ConfigurationType>
          <HostName>host-name-for-the-vm</HostName>
          <UserName>new-user-name</UserName> 
          <UserPassword>password-for-the-new-user</UserPassword> 
          <DisableSshPasswordAuthentication>true|false</DisableSshPasswordAuthentication>           
          <SSH>
            <PublicKeys>
              <PublicKey>
                <FingerPrint>certificate-fingerprint</FingerPrint>
                <Path>SSH-public-key-storage-location</Path>     
              </PublicKey>
            </PublicKeys>
            <KeyPairs>
              <KeyPair>
                <FingerPrint>certificate-fingerprint</FingerPrint>
                <Path>SSH-public-key-storage-location</Path>
              </KeyPair>
            </KeyPairs>
          </SSH>
        </ConfigurationSet>-->
        <ConfigurationSet>
          <ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>          
          <InputEndpoints>
            <InputEndpoint>
              <LoadBalancedEndpointSetName>Remote Desktop</LoadBalancedEndpointSetName>
              <LocalPort>3389</LocalPort>
              <Name>RemoteDesktop</Name>
              <Port>80</Port>
              <LoadBalancerProbe>
                <Path></Path>
                <Port></Port>
                <Protocol></Protocol>
                <IntervalInSeconds></IntervalInSeconds>
                <TimeoutInSeconds></TimeoutInSeconds>
              </LoadBalancerProbe>
              <Protocol>TCP</Protocol>                    
            </InputEndpoint>
          </InputEndpoints>
          <SubnetNames>
            <SubnetName>FrontEndSubnet1</SubnetName>
            <SubnetName>BackEndSubnet1</SubnetName>
          </SubnetNames>
        </ConfigurationSet>
      </ConfigurationSets>
      <AvailabilitySetName></AvailabilitySetName>
      <DataVirtualHardDisks>
        <DataVirtualHardDisk>
          <HostCaching>ReadWrite</HostCaching>
          <DiskLabel>myDiskLabel</DiskLabel>
          <DiskName>newname</DiskName>
          <Lun>3</Lun>
          <LogicalDiskSizeInGB>16gb</LogicalDiskSizeInGB>
          <MediaLink>http://teststorageaccounts.blob.core.windows.net/vhds/TestsRock.vhd</MediaLink>
        </DataVirtualHardDisk>
      </DataVirtualHardDisks>
      <OSVirtualHardDisk>
        <HostCaching>ReadWrite</HostCaching>
        <DiskLabel>myosdisklabel</DiskLabel>
        <DiskName>newname</DiskName>
        <MediaLink>http://teststorageaccounts.blob.core.windows.net/vhds/TestsRockets.vhd</MediaLink>
        <SourceImageName>03f55de797f546a1b29d1b8d66be687a__Visual-Studio-2013-Preview-Ultimate-12.0.20617.1</SourceImageName>
      </OSVirtualHardDisk>
      <RoleSize>Small</RoleSize>
    </PersistentVMRole>

我有这个请求体来创建VM。我想要完成的是在一个cloudservice上创建许多虚拟机,但不幸的是我的请求体是无效的,我找不到什么错误。任何人都可以帮助我或提供一些工作样本。我跟着这个documentation。感谢

2 个答案:

答案 0 :(得分:1)

我只想确保您知道Windows Azure VMRole已经停用,现在您可以使用更多Windows Azure IaaS虚拟机,以下链接可以为您提供更多帮助:

什么是Windows Azure虚拟机: http://www.windowsazure.com/en-us/services/virtual-machines/

将Windows Azure VMRole迁移到Windows Azure虚拟机: http://msdn.microsoft.com/en-us/library/windowsazure/dn133483.aspx

答案 1 :(得分:0)

我认为文档不是最新的。请尝试添加以下节点

<AdminUsername>adminusername</AdminUsername>

之后

<AdminPassword>MyPassword!</AdminPassword>

节点。

此外,如果您收到WebException,您可以尝试读取该WebException的响应,并且应该提供有关该错误的更多详细信息。例如:

    catch (WebException webEx)
    {
        using (var respStream = new System.IO.StreamReader(webEx.Response.GetResponseStream()))
        {
            var detailedErrorMessage = respStream.ReadToEnd();
        }
    }

在这里,detailedErrorMessage应该为您提供一个XML,其中包含有关错误的更多详细信息。