Question

I have the following problem. Let me describe the steps I took so far...

  1. I created a new WCF Service Application in Visual Studio
  2. I then updated the project via Nuget to get the latest web http libs (webapi.dll)
  3. I then created a service method that looks like this

`

[ServiceContract]
public interface IService
{
        [OperationContract]
        [WebInvoke(Method="POST", UriTemplate="{value}")]
        string GetData(int value, Stream inputDocument);
}

`

Now attempting to view the my .svc in the browswer results in an error that says "For request in operation GetData to be a stream the operation must have a single parameter whose type is Stream"

I know this is an issue with configuration, I just don't know what needs to change in web.config Mind you, this seems to have been a common problem in WCF before the new HTTP support, I'm somewhat surprised that this doesn't work out of the box with the new APIs.

Any pointers?

Thanks

[EDIT] I've included my config...

<system.serviceModel>
    <services>
      <service name="MyService.Service" behaviorConfiguration="serviceBehaviour">
        <endpoint behaviorConfiguration="endPointBehaviour" address="" binding="webHttpBinding" contract="MyService.IService"/>
      </service>
    </services>    
    <bindings>
      <webHttpBinding>
        <binding transferMode="Streamed" name="webHttpBinding" />
      </webHttpBinding>
    </bindings>

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

      <serviceBehaviors>
        <behavior name="serviceBehaviour">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>    
  </system.serviceModel>

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top