Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing WCF Web apis (REST) to support Streamed data
    primarykey
    data
    text
    <p>I have the following problem. Let me describe the steps I took so far...</p> <ol> <li>I created a new WCF Service Application in Visual Studio</li> <li>I then updated the project via Nuget to get the latest web http libs (webapi.dll)</li> <li>I then created a service method that looks like this </li> </ol> <p>`</p> <pre><code>[ServiceContract] public interface IService { [OperationContract] [WebInvoke(Method="POST", UriTemplate="{value}")] string GetData(int value, Stream inputDocument); } </code></pre> <p>`</p> <p>Now attempting to view the my <strong>.svc</strong> in the browswer results in an error that says "<strong>For request in operation GetData to be a stream the operation must have a single parameter whose type is Stream</strong>"</p> <p>I know this is an issue with configuration, I just don't know what needs to change in <strong>web.config</strong> 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.</p> <p>Any pointers?</p> <p>Thanks</p> <p>[EDIT] I've included my config...</p> <pre><code>&lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="MyService.Service" behaviorConfiguration="serviceBehaviour"&gt; &lt;endpoint behaviorConfiguration="endPointBehaviour" address="" binding="webHttpBinding" contract="MyService.IService"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;webHttpBinding&gt; &lt;binding transferMode="Streamed" name="webHttpBinding" /&gt; &lt;/webHttpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;endpointBehaviors&gt; &lt;behavior name="endPointBehaviour"&gt; &lt;webHttp/&gt; &lt;/behavior&gt; &lt;/endpointBehaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="serviceBehaviour"&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload