XML规范无效:命名空间“http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition”中的元素“WebRole”具有不完整的内容。预期可能元素列表:名称空间“http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition”中的“站点”。
这是XML文件
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureCloudService1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="Web" vmsize="Small">
<Startup>
<Task commandLine="StartUp.cmd" executionContext="elevated" taskType="background" />
</Startup>
</WebRole>
</ServiceDefinition>
答案 0 :(得分:0)
正如错误所示....您的<WebRole>
标记必须包含<Sites>
节点。
答案 1 :(得分:0)
创建Azure Cloud Service项目时,解决方案资源管理器中将显示默认ServiceDefinition.csdef
,其中包含以下内容,
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureCloudService1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="WebRole1" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
<Setting name="StorageConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
</WebRole>
<WorkerRole name="WorkerRole1" vmsize="Small">
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
</WorkerRole>
</ServiceDefinition>
所以,你错过了一个<Sites>
节点。