Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

wcf

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

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

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

Does anyone know how to fix this?

like image 945
Sam Avatar asked Apr 06 '11 00:04

Sam


1 Answers

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>
like image 93
Rest Wing Avatar answered Sep 23 '22 22:09

Rest Wing