wcf guru needed
wcf guru needed

Reputation: 69

Strange error when trying to start my WCF service with webHttpBinding

I'm getting this strange error when I try connect to my WCF with webHttpBinding service from a web browser:

Sendera:ActionNotSupportedThe message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

My app.config:

<services>
  <service name="MyNamespace.MyService">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9091/MyService/" />
      </baseAddresses>
    </host>
    <endpoint address="" binding="webHttpBinding" contract="MyNamespace.IMyService" />
  </service>
</services>

My method simply looks like this:

[WebGet(UriTemplate = "foo/{id}")]
public string GetFoo(string id)
{ ...

Upvotes: 1

Views: 2827

Answers (2)

marc_s
marc_s

Reputation: 754438

OK - I would expect you're probably missing the endpoint behavior needed - try this config:

<behaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
</behaviors>    
<services>
  <service name="MyNamespace.MyService">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9091/MyService/" />
      </baseAddresses>
    </host>
    <endpoint 
        address="" 
        behaviorConfiguration="web"
        binding="webHttpBinding" 
        contract="MyNamespace.IMyService" />
  </service>
</services>

Upvotes: 2

Metro Smurf
Metro Smurf

Reputation: 38335

When you updated your method from GetFoo(string fooID) to GetFoo(string id), did you also update your contract in IMyService with the updated parameter name of id?

Reference of your previous question: Is there a way to have custom defined friendly URLs with WCF without IIS?

Upvotes: 0

Related Questions