2013-07-28 20 views
0
<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> 

我有這個請求主體來創建虛擬機。我想完成的是在一個雲服務上創建多個虛擬機,但不幸的是,我的請求主體是無效的,我無法找到什麼錯誤。任何人都可以幫我在這裏或提供一些工作樣本。我跟着這個documentation。謝謝XML請求正文:在Windows Azure上無效

回答

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。

+0

還是同樣的錯誤。 detailedErrorMessage返回給我空白(空格)。 我要求:https://management.core.windows.net/subscriptionID/services/hostedservices/CloudService/deployments/Production/roles 是這樣嗎? –

+0

你得到了什麼確切的錯誤?您正在執行「添加角色」操作。基於這裏的文檔:http://msdn.microsoft.com/en-us/library/windowsazure/jj157186.aspx,請求的URL應該包括'deploymentname',但我認爲你在那裏傳遞'部署槽'。您可以通過提供有效的部署名稱來嘗試嗎?目前,你正在嘗試在你的請求中做很多事情。我可以建議你先創建一個虛擬機,然後把所有的東西都放在外面。它可以幫助您更快地查明錯誤。 –