gpt4 book ai didi

azure - 使用命令行工具cspack时出错

转载 作者:行者123 更新时间:2023-12-03 04:31:06 25 4
gpt4 key购买 nike

执行 cspack 命令时出现以下错误“错误 CloudServices051:XML 规范无效:命名空间“http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition”中的元素“WebRole”内容不完整。所需的可能元素列表:命名空间“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>

最佳答案

根据您的示例,我猜测您正在使用 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 日),它明确表示:

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)

关于azure - 使用命令行工具cspack时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36427184/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com