【发布时间】:2016-04-27 23:30:14
【问题描述】:
我在云服务中有两个 Web 角色,一个对外公开,一个供内部使用。外部 Web 角色有一个 MVC Web 应用程序,该应用程序必须连接到具有 Web API 的内部 Web 角色。我的 Azure 云服务有以下服务定义。
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureWeb_ExternalCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="ExternalWebApplication" vmsize="A6">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
<Setting name="ServiceBaseURL" />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
</WebRole>
<WebRole name="InternalWebAPI" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint2" endpointName="Endpoint2" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InternalEndpoint name="Endpoint2" protocol="http" port="8080" />
</Endpoints>
</WebRole>
<NetworkTrafficRules>
<OnlyAllowTrafficTo>
<Destinations>
<RoleEndpoint roleName="InternalWebAPI" endpointName="Endpoint2"/>
</Destinations>
<WhenSource matches="AnyRule">
<FromRole roleName="ExternalWebApplication"/>
</WhenSource>
<AllowAllTraffic/>
</OnlyAllowTrafficTo>
</NetworkTrafficRules>
</ServiceDefinition>
但是,当我尝试构建时出现以下错误。
XML 规范无效:元素“OnlyAllowTrafficTo” 在命名空间中 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition' 命名空间中有无效的子元素“AllowAllTraffic” 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition'
【问题讨论】:
标签: asp.net-mvc azure azure-web-roles azure-cloud-services