开发者

WCFExtras - the element bahavior has invalid child element 'wsdlExtensions'?

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

"wsdlExtensions" has a blue line beneath it indicating something wrong.

The element 'behavior' has inva开发者_Python百科lid child element 'wsdlExtensions' ...

Does anyone know how to fix this?


Define schema for behavior extension element wsdlExtensions.

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

Include the schema of new element in schema file used for Intellisense

Visual Studio usually uses the %VS_INSTALL_DIR%\xml\Schemas\DotNetConfig.xsd file for Intellisense, unless the Visual Studio is configured to use some other file.

To check which files are used for Intellisense, select XML->Schemas while configuration file is open. All files having a tick mark in Use column are used for Intellisense.

<?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>

Define new element at appropriate level in schema file

The appropriate level for the wsdlExtensions behavior extension element is system.serviceModel/C/behaviors/C/endpointBehaviors/C/behavior/C where C is complexType/choice element.

<?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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜