I am uploading a file via a webservice using REST and receiving an error message because I have multiple parameters in my POST WEBINVOKE.
this is error message...
For request in operation transferData to be a stream the operation must have a single parameter whose type is Stream.
I've read THOUSANDS of tutorials on this and I see other people have the same problem however I don't see a real solution for me.
any ideas on what
namespace EngineAppServiceV001
{
the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "/DoWork/{cid}",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest)]
DataSet DoWork(string cid);
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "/UploadFile/{fileName}")]
string transferData(string filename, Stream fileStream);
}
Here is my web.config
<bindings>
<basichttpbinding>
<binding maxbuffersize="2147483647" maxreceivedmessagesize="2147483647">
<readerquotas maxdepth="32" maxstringcontentlength="2147483647">
maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</readerquotas></binding>
</basichttpbinding>
<webhttpbinding>
<binding name="ServiceWebBindingName" transfermode="Streamed" maxbuffersize="2147483647" maxreceivedmessagesize="2147483647">
<security mode="None"></security>
</binding>
</webhttpbinding>
</bindings>
<services>
<service name="EngineAppServiceV001.Service1" behaviorconfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" contract="EngineAppServiceV001.IService1" behaviorconfiguration="web" />
</service>
</services>
<behaviors>
<servicebehaviors>
<behavior name="ServiceBehaviour">
<servicemetadata httpgetenabled="true" httpsgetenabled="true" />
<servicedebug includeexceptiondetailinfaults="true" />
</behavior>
</servicebehaviors>
<endpointbehaviors>
<behavior name="web">
<webhttp />
</behavior>
</endpointbehaviors>
</behaviors>