When trying to pass a small FileStream to my WCF service I get "Timeouts are not supported on this stream" error. Can anyone see what I'm doing wrong?
Interface:
[OperationContract]
List<SystemClass> ReadExcelFile(System.IO.FileStream stream);
Web.Config
<bindings>
<basicHttpBinding>
<binding name="streaming" maxReceivedMessageSize="2147483647" transferMode="Streamed">
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MISDashboard.wcfService" behaviorConfiguration="">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="streaming" contract="MISDashboard.wcfService"></endpoint>
</service>
</services>
...
<httpRuntime maxRequestLength="2147483647"/>
Do not use FileStream
as parameter but Stream
. A FileStream
is a stream bound to the local file system; once you start transferring the data, in the other side the stream will be coming from the network, so a FileStream can't be used there.
You could believe it's pretty the same but Stream
is treated in a special way by WCF and by-pass many internal tasks.
Also, for sending Large Data consider reading this great article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With