मुझे यह त्रुटि मेरे कस्टम व्यवहार एक्सटेंशन के साथ मिली थी जिसे मैं एंडपॉइंट व्यवहार के रूप में जोड़ना चाहता था। इसलिए, मैंने अपने web.config फ़ाइल में चेतावनी से छुटकारा पाने के लिए विजुअल स्टूडियो 2017 में उपयोग की गई स्कीमा संपादित की।यह वही चेतावनी है जिसे आपने प्राप्त किया:
तत्व 'व्यवहार' में अमान्य बाल तत्व 'कस्टम सुरक्षा' है। अपेक्षित संभावित तत्वों की सूची: 'क्लाइंटविया, कॉलबैकडिबग, कॉलबैकटाइमआउट, स्पष्ट, क्लाइंट क्रेडेंशियल्स, ट्रांज़ेक्टेड बैचिंग, डेटा कंट्रैक्टसाइरियलाइज़र, डिस्पैचर सिंक्रनाइज़ेशन, हटाएं, सिंक्रोनस रिसीसीव, वेब एचटीपी, सक्षम वेबस्क्रिप्ट, एंडपॉइंट डिस्वरी, साबुनप्रोसेसिंग'।
मेरे web.config है:
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="CustomSecurity"
type="FullyQualifiedPath.MyCustomBehaviorExtension, MyAssemblyName"/>
</behaviorExtensions>
</extensions>
<endpointBehaviors>
<behavior name="CustomServiceBehavior">
<CustomSecurity />
</behavior>
</endpointBehaviors>
<endpoint address="https://SomeServer/MyService.svc/soap"
behaviorConfiguration="CustomServiceBehavior" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IProject" contract="ProjectService.IProject"
name="BasicHttpBinding_IProject" />
CustomSecurity एक्सएमएल नोड हमेशा दृश्य स्टूडियो में इसे नीचे नीले टेढ़ा-मेढ़ा लाइन थी। यह त्रुटि सूची विंडो में चेतावनी के रूप में दिखाई देता है। मैं इससे छुटकारा पाना चाहता था क्योंकि हर बार जब मैंने सेवा संदर्भ को अपडेट करने का प्रयास किया था, तो यह web.config में चेतावनी के कारण विफल हो जाएगा।
तो, इसे ठीक करने के लिए, आपको स्कीमा संपादित करना होगा जो विजुअल स्टूडियो तत्वों को सत्यापित करने के लिए उपयोग करता है। इसलिए, मैंने अपना web.config खोला, फिर मुख्य विजुअल स्टूडियो मेनू बार पर एक्सएमएल चुना। फिर Schemas का चयन करें। आपको स्कीमा की एक लंबी सूची मिल जाएगी। जैसा कि नीचे देखा गया है "DotNetConfig.xsd" खोजें।
दिखाए गए पथ पर ब्राउज़ करें और xsd फ़ाइल संपादित करें। के लिए खोजें: <xs:element name="behavior" vs:help="configuration/system.serviceModel/behaviors/endpointBehaviors/behavior">
फिर एक नया एक्सएस जोड़ें: xs के भीतर तत्व नोड: अपने कस्टम व्यवहार एक्सटेंशन के नाम के साथ पसंद नोड; मेरे मामले में, कस्टम सुरक्षा। फ़ाइल को सहेजें और विजुअल स्टूडियो को स्वचालित रूप से नई स्कीमा के विरुद्ध सत्यापित करना चाहिए और आपको अब अपने web.config में कोई चेतावनी नहीं मिलनी चाहिए।
<xs:element name="behavior" vs:help="configuration/system.serviceModel/behaviors/endpointBehaviors/behavior">
<xs:complexType>
<xs:annotation>
<xs:documentation>The behavior element contains a collection of settings for the behavior of an endpoint.</xs:documentation>
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="CustomSecurity" vs:help="configuration/system.serviceModel/behaviors/endpointBehaviors/behavior/CustomSecurity">
<xs:complexType>
<xs:annotation>
<xs:documentation>Specifies the behavior extension class applied to the endpoint.</xs:documentation>
</xs:annotation>
<xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict" />
</xs:complexType>
</xs:element>
<xs:element name="clientVia" vs:help="configuration/system.serviceModel/behaviors/endpointBehaviors/behavior/clientVia">
<xs:complexType>
<xs:annotation>
<xs:documentation>Specifies the URI for which the transport channel should be created.</xs:documentation>
</xs:annotation>
<xs:attribute name="viaUri" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>A string that specifies a URI that indicates the route a message should take.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lockAttributes" type="xs:string" use="optional" />
<xs:attribute name="lockAllAttributesExcept" type="xs:string" use="optional" />
<xs:attribute name="lockElements" type="xs:string" use="optional" />
<xs:attribute name="lockAllElementsExcept" type="xs:string" use="optional" />
<xs:attribute name="lockItem" type="boolean_Type" use="optional" />
<xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict" />
</xs:complexType>
</xs:element>
http://connect.microsoft.com/VisualStudio/feedback/details/619106/wcf-fails-to-find-custom-behaviorextensionelement-if-type-attribute-doesnt-match-exactly – nologo
संभव डुप्लिकेट [सुनवाई "तत्व 'व्यवहार' में अमान्य बाल तत्व है" को अनदेखा किया जाना चाहिए, लेकिन इसके कारण सेवा संदर्भ को अपडेट करने से रोका गया है] (http://stackoverflow.com/questions/9482091/hearing-element-behavior-has-invalid- बच्चे-तत्व-होना-अनदेखा-लेकिन-पीआर) – McGarnagle