1
votes

I am getting following error when executing cspack command "Error CloudServices051 : The XML specification is not valid: The element 'WebRole' in namespace 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition' has incomplete content. List of possible elements expected: 'Sites' in namespace 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition'."

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="CloudService1"      xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebRole1" enableNativeCodeExecution="false">
<InputEndpoints>
 <InputEndpoint name="HttpIn" protocol="http" port="80"/>
</InputEndpoints>
    <ConfigurationSettings/>
</WebRole>
</ServiceDefinition>
1
I didn't have any luck trying to work with CSPack due to virtually no documentation. What are you trying to accomplish?Mikee
I have just started writing hello world program in Azure and following a book. In the book author has suggested to use command line tool as it gives good insight into technology to beginners. Anyway will switch to MSVS but before that wanted to debug this problemShailesh

1 Answers

0
votes

My guess from you example is that you're working with the book Programming Windows Azure, by Sririam Krishnan.

This was published in May 2010. Either the book presented a broken example, or some breaking change has since been introduced to the Azure framework since then.

Below is the ServiceDefinition.csdef file from page 51, modified to work with the Azure SDK v2.8:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="CloudService1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" > 
  <WebRole name="WebRole1" enableNativeCodeExecution="false">
    <InputEndpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="80" />
    </InputEndpoints>
    <ConfigurationSettings />
    <!-- This sites node was not included in the example -->
    <Sites>
        <Site name="TokenSite" physicalDirectory="htmlwebsite">
            <Bindings>
                <Binding name="BindingOne" endpointName="HttpIn" />
            </Bindings>     
        </Site>
    </Sites>
  </WebRole>
</ServiceDefinition>

The addition was the Sites node, containing one site. The physicalDirectory attribute had to point to the folder that contains the html file. Until I added the Sites node, the cspack utility failed.

Interestingly, if you read about the Sites element in the Azure Online Documentation, (last updated April 15th, 2015), it explicitly says:

If you do not specify a Sites element, your web role is hosted as legacy web role and you can only have one website hosted in your web role. ... This element is optional and a role can have only one sites block. (my italics)