Hello WCF Friends,i have a major problem.
i'm trying to download files using REST WCF, but it appears that, for example, 16MB file takes me 56 seconds, but in regular download (same source - from a website we have) - it takes 8 seconds.
In the client side, i'm reading the chunks like that:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(test.FullURL);
request.Method = test.Method.ToString();
if (test.Method != TestMethod.GET)
{
request.ContentType = "application/json";
using (Stream requestStream = request.GetRequestStream())
{
byte[] inputStringBytes = Encoding.UTF8.GetBytes(test.InputData);
requestStream.Write(inputStringBytes, 0, inputStringBytes.Length);
}
}
using (var response = request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
char[] btArray = new char[5242880];
watch.Start();
StreamReader rdr = new StreamReader(responseStream, Encoding.UTF8);
int idx = 0;
int length = 0;
while (!rdr.EndOfStream)
{
idx = rdr.ReadBlock(btArray, 0, 5242880);
}
watch.Stop();
Console.WriteLine(watch.Elapsed);
}
}
I'm using 5MB chunks, the file is 16MB as i said.
the configuration is basiclly:
<service behaviorConfiguration="httpBehavior" name="Name">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpBindingConfig" behaviorConfiguration="web" contract="IService" />
</service>
...
...
<webHttpBinding>
<binding name="webHttpBindingConfig" transferMode="Streamed" maxBufferSize="52428800" maxReceivedMessageSize="52428800">
<readerQuotas maxDepth="32" maxStringContentLength="52428800" maxArrayLength="52428800" maxBytesPerRead="52428800" maxNameTableCharCount="52428800"/>
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
</security>
</binding>
</webHttpBinding>
(i even did large numbers in all configurations to see if that helps - nothing).
Am i missing something?
Thanks.