WCFExtras - 元素bahavior有无效的子元素'wsdlExtensions'?

时间:2011-04-06 00:51:51

标签: wcf

<endpointBehaviors>
  <behavior name="singleFileEndpointBehavior">
    <wsdlExtensions singleFile="True" />
  </behavior>
</endpointBehaviors>

“wsdlExtensions”下方有一条蓝线表示错误。

The element 'behavior' has invalid child element 'wsdlExtensions' ...

有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:7)

定义行为扩展元素wsdlExtensions的架构。

<xs:complexType name="wsdlExtensions">
    <xs:attribute name="singleFile" type="boolean_Type" use="optional" default="True" />
</xs:complexType>

在用于Intellisense的模式文件中包含新元素的架构

Visual Studio通常使用%VS_INSTALL_DIR%\xml\Schemas\DotNetConfig.xsd文件进行Intellisense,除非Visual Studio配置为使用其他文件。

要检查哪些文件用于智能感知,请在配置文件打开时选择 XML-&gt;模式。在Use列中具有刻度标记的所有文件都用于智能感知。

<?xml version="1.0" encoding="us-ascii"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense"
           elementFormDefault="qualified" attributeFormDefault="unqualified"
           vs:helpNamespace="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <!-- Child elements omitted for brevity -->
</xs:schema>

在架构文件中的适当级别定义新元素

wsdlExtensions行为扩展元素的适当级别是 system.serviceModel/C/behaviors/C/endpointBehaviors/C/behavior/C其中CcomplexType/choice元素。

<?xml version="1.0" encoding="us-ascii"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense"
           elementFormDefault="qualified" attributeFormDefault="unqualified"
           vs:helpNamespace="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <!-- Omitted elements at various levels for brevity -->
    <xs:element name="system.serviceModel" vs:help="configuration/system.serviceModel">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="behaviors" vs:help="configuration/system.serviceModel/behaviors">
                    <xs:complexType>
                        <xs:choice minOccurs="0" maxOccurs="unbounded">
                            <xs:element name="endpointBehaviors" vs:help="configuration/system.serviceModel/behaviors/endpointBehaviors">
                                <xs:complexType>
                                    <xs:choice minOccurs="0" maxOccurs="unbounded">
                                        <xs:element name="behavior" vs:help="configuration/system.serviceModel/behaviors/endpointBehaviors/behavior">
                                            <xs:complexType>
                                                <xs:choice minOccurs="0" maxOccurs="unbounded">
                                                    <xs:element name="wsdlExtensions" type="wsdlExtensions" />
                                                </xs:choice>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:choice>
                                </xs:complexType>
                            </xs:element>
                        </xs:choice>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
相关问题