Link to home
Create AccountLog in
Avatar of Enill
Enill

asked on

WCF REST + WebClient + Large File Transfer

Hi,

I have a IIS Hosted WCF REST Service where i host some big file, between 300mb-1gb. I use WCF REST model because there will client of different platform, language and such so using GET/POST seem natural to me in this condition.

For some reason, i am able to transfer file of 120mb to the server, but the client can't receive file of over 70mb.(Im still far from my 300mb minimum). Maybe its a WCF config problem, maybe its a IIS 7.5 problem, i dont know. I am still new to all the IIS stuff.

 

Here is my configurations:

WEB.CONFIG:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="webHttpBindingConfig" maxReceivedMessageSize ="2147483647" maxBufferPoolSize="2147483647" >
          <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
        </binding>
        <!--<binding name="webHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096"/>
        </binding>-->
      </webHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
      <service name="Engine" behaviorConfiguration="Default">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="webHttpBinding" contract="IEngine" bindingConfiguration="webHttpBindingConfig" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Default">
          <serviceThrottling maxConcurrentCalls="5000" maxConcurrentInstances="5000" maxConcurrentSessions="5000"></serviceThrottling>
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.web>
    <compilation debug="true" />
    <httpRuntime maxUrlLength="2097151" maxQueryStringLength="2097151" maxRequestLength="2147483647" />
  </system.web>
</configuration>

 

APP.CONFIG(WPF Client using WebClient for requests):

<?xml version="1.0"?>
<configuration>
<startup>
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
  <system.web>
    <!--<compilation debug="true" />-->
    <!--<httpRuntime maxUrlLength="2097151" maxQueryStringLength="2097151" maxRequestLength="2147483647" />-->
    <httpRuntime maxRequestLength="2147483647" />
  </system.web>
</configuration>

 

WebClient code for the request:

client.UploadFileCompleted += new UploadFileCompletedEventHandler(client_UploadFileCompleted);
client.UploadFileAsync(new Uri(gVarC.SERVER_ADDRESS_DEV + "Sub?"), "POST", @"C:\Video\Video.rar");

Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of Najam Uddin
Najam Uddin
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account