मैं डब्ल्यूसीएफ के साथ एक समस्या को हल करने की कोशिश कर रहा था। मैं डब्ल्यूसीएफ के लिए बहुत नया हूं इसलिए मुझे यकीन नहीं था कि वास्तव में क्या चल रहा था।AspNetCompatibilityRequirementsMode.Allowed इस त्रुटि को ठीक क्यों करता है?
मैं विजुअल स्टूडियो 2010 का उपयोग कर रहा हूं और नई वेब साइट-> डब्ल्यूसीएफ सेवा करता हूं। मैंने अपनी सेवा और कॉन्फ़िगरेशन फ़ाइल में बनाई है, अगर मैं aspNetCompatibilityEnabled="true"
सेट करता हूं, तो मुझे अपने वेब ब्राउज़र के माध्यम से सेवा में जाने पर यह त्रुटि मिल जाएगी।
The service cannot be activated because it does not support ASP.NET compatibility.
ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config
or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode
setting as 'Allowed' or 'Required'.
मुझे समझ में नहीं आता कि इसका क्या अर्थ है। aspNetCompatibilityEnabled="true"
इस त्रुटि का कारण बनता है जब [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
इसे हल करता है।
मेरे लिए, वे ध्वनि की तरह लगते हैं। इसके अलावा, उस विशेषता के बिना चांदी की रोशनी मेरे डब्ल्यूसीएफ तरीकों को कॉल करने में सक्षम नहीं थी। ऐसा क्यों है?
यहाँ मेरी कॉन्फ़िग फ़ाइल यदि आवश्यक है:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<services>
<service name="Services.Exporter">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer"
contract="Services.IExporter" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment
multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
तो मेरे सवाल है, क्यों संगतता जोड़ने करता विशेषता है कि ठीक? इसके अलावा, चांदी की रोशनी के लिए यह क्यों जरूरी था?
प्रश्न, यदि यह सही है तो यह उचित सजावट क्या होगी? – Justin
यह इस बात पर निर्भर करता है कि आपकी सेवा को एएसपी.नेट पाइपलाइन के साथ उपलब्ध वस्तुओं की आवश्यकता है या नहीं। यदि आप वास्तव में परवाह नहीं करते हैं, तो आप इसे 'आवश्यकताएँ मोड' अनुमति देंगे। यदि आप उन घटकों (सत्र की तरह) पर भरोसा करते हैं, तो आपको इसे 'आवश्यकताएँ मोड। आवश्यक' पर सेट करना चाहिए। –