我在执行cspack命令时遇到以下错误:错误CloudServices051 : XML规范无效:命名空间'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition‘中的元素'WebRole’内容不完整。可能的元素列表应为:命名空间‘http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition’中的'Sites‘。
<?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>发布于 2016-04-24 14:30:45
我从您的示例中猜测,您正在使用Sririam Krishnan的《Windows Azure编程》一书。
这篇文章发表于2010年5月。这本书要么是一个失败的例子,要么是自那以后Azure框架中引入了一些破坏性的变化。
下面是来自第51页的ServiceDefinition.csdef文件,经过修改以与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>添加的是Sites节点,包含一个站点。physicalDirectory属性必须指向包含html文件的文件夹。在我添加Sites节点之前,cspack实用程序失败。
有趣的是,如果你读到Azure Online Documentation中的Sites元素(2015年4月15日最后更新),它明确地说:
如果未指定站点元素,则您的web角色将作为旧web角色托管,并且您的web角色中只能托管一个网站。..。此元素是可选的,并且一个角色只能有一个站点块。(我的斜体)
https://stackoverflow.com/questions/36427184
复制相似问题