मुझे एंडपॉइंट्स, व्यवहार इत्यादि के साथ डब्ल्यूसीएफ सेटअप से नफरत है। मुझे विश्वास है कि इन सभी चीजों को स्वचालित रूप से किया जाना चाहिए। मैं बस अपनी डब्ल्यूसीएफ सेवा से जेएसओएन परिणाम वापस करना चाहता हूं। यहाँ मेरी विन्यास है:डब्ल्यूसीएफ कॉन्फ़िगरेशन नरक?
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="default"/>
</webHttpBinding>
</bindings>
<services>
<service name="HighOnCodingWebApps.ZombieService"
behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="" binding="webHttpBinding"
bindingConfiguration="default"
contract="HighOnCodingWebApps.IZombieService"
behaviorConfiguration="webScriptEnablingBehavior"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webScriptEnablingBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"/>
और मैं निम्न सेवा कार्यान्वयन है:
public class ZombieService : IZombieService
{
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "KnownZombies")]
public Zombie GetZombie()
{
return new Zombie() { Name = "Mohammad Azam"};
}
}
public class Zombie
{
public string Name { get; set; }
}
जब मैं http://localhost:22059/ZombieService/KnownZombies
निम्न संदेश का कहना है:
Endpoints का उपयोग कर 'UriTemplate' नहीं कर सकते 'System.ServiceModel.Description.WebScriptEnablingBehavior' के साथ प्रयोग किया जाए।
मैं web.config मैं निम्नलिखित त्रुटि मिलती से WebScriptEnablingBehavior निकालते हैं:
The message with To 'http://localhost:22059/ZombieService.svc/KnownZombies' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
अद्यतन 1:
मैं इस के लिए विन्यास अद्यतन:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="default"/>
</webHttpBinding>
</bindings>
<services>
<service name="HighOnCodingWebApps.ZombieService"
behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="http://localhost:22059/ZombieService.svc" binding="webHttpBinding"
bindingConfiguration="default"
contract="HighOnCodingWebApps.IZombieService"
/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="SomeBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
अब जब मैं http://localhost:22059/ZombieService.svc/KnownZombies
पर जाता हूं मुझे ब्राउज़र में निम्न संदेश मिलता है:
The message with To 'http://localhost:22059/ZombieService.svc/KnownZombies' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
कुछ भी ऊपर खींच नहीं है? क्या आप कुछ सहायक पोस्ट करने का प्रयास कर सकते हैं, और शायद एक प्रश्न शामिल कर सकते हैं? –
डब्ल्यूसीएफ 4.0 देखें - इसने ** ** कॉन्फ़िगरेशन सिरदर्द के बहुत सारे ** का उपचार किया है! व्यापक विवरण के लिए [एक डेवलपर का परिचय डब्ल्यूसीएफ 4] (http://msdn.microsoft.com/en-us/library/ee354381.aspx) पढ़ें। –
अपडेट सवाल – azamsharp