.netwcfrestwebinvoke

WCF REST WebInvoke UriTemplate & https Issue


My WCF service works with WebInvoke attributes and using httpGetEnabled.

[OperationContract]
[WebInvoke(Method="POST", UriTemplate = "/Function1")]
void Function1(Stream input);

[OperationContract]
[WebInvoke(Method="POST", UriTemplate = "/Function2")]
void Function2( Stream input );

When I try to get it to work with https, I cannot access the UriTemplates. I can however, access the svc and wsdl.

<services>
  <service behaviorConfiguration="SslBehavior" name="MyService">
    <endpoint address="" binding="webHttpBinding" contract="IMyService" behaviorConfiguration="WebBehavior" />
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="SslBehavior">
      <serviceMetadata httpsGetEnabled="True" />
      <serviceDebug includeExceptionDetailInFaults="True"/>
    </behavior>
  </serviceBehaviors>

  <endpointBehaviors>
    <behavior name="WebBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>

This service is hosted in IIS 7. Is there something obvious that I'm missing? I've tried as many combinations of configuration as possible. When I try to post to one of the WebInvoke links I get a 404 error.

Another company will be posting to this service, which is why it must be RESTfull

Edit

I did try this in the bindings node:

  <webHttpBinding>
    <binding name="SslBinding" transferMode="Streamed">
      <security mode="None">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </webHttpBinding>

And set the BindingConfiguration on the endpoint. Same issue :(


Solution

  • Try setting seucrity mode to Transport:

    <bindings>
      <webHttpBinding>
        <binding name="SslBinding" transferMode="Streamed">
          <security mode="Transport">  
            <transport clientCredentialType="None" />     
        </security>     
      </binding>   
    </webHttpBinding>