none
how to send large data up to 200 MB from wcf soap service to client as WPF ? RRS feed

  • Question

  • I have created a WCF service which work fine for some methods but when I try to access some methods which returns some large data then I getting the following error

    An error occurred while receiving the HTTP response to http://localhost:9321/Service1.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

    I have written my Service config file like this

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
      
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      
      <system.web>
       
        <compilation debug="true" targetFramework="4.5">
          <assemblies>
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          </assemblies>
        </compilation>
       
        <httpRuntime targetFramework="4.5" maxRequestLength="262144" executionTimeout="103600" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <!--<wsHttpBinding>
            <binding name="MyWsHttpBinding" maxBufferPoolSize="6553600" maxReceivedMessageSize="6553600" messageEncoding="Mtom" >
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
                  maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                  maxNameTableCharCount="2147483647" />
            </binding>
          </wsHttpBinding>-->
          <netHttpBinding>
            <binding name="SomeBinding" transferMode="Streamed">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
            </binding>
          </netHttpBinding>
               
        </bindings>
        
        <services>
          <service name="CognoseWCFService.Service1" >
            <endpoint address="" binding="netHttpBinding" contract="CognoseWCFService.IService1"/>
            
          </service>
        </services>
        
        <behaviors>
         
          <serviceBehaviors>
            <behavior>
              
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        
        <protocolMapping>
          <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="true" />
      </system.webServer>
      
      <connectionStrings>
        <add name="EPCEntities" connectionString="metadata=res://*/Model.EPCDataModel.csdl|res://*/Model.EPCDataModel.ssdl|res://*/Model.EPCDataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.0.11;initial catalog=EPC;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
        <add name="ErwinDataEntities" connectionString="metadata=res://*/Model.ErwinDataModel.csdl|res://*/Model.ErwinDataModel.ssdl|res://*/Model.ErwinDataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.0.11;initial catalog=ErwinData;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>
      
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="v11.0" />
          </parameters>
        </defaultConnectionFactory>
      </entityFramework>
    </configuration>

    and client side web.config like this

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
      <connectionStrings>
        <add name="OracleConnection" connectionString="Data Source=orcl;User ID=Erwin_Database;Password=erwin;Unicode=True" providerName="System. Data. OracleClient" />
      <add name="ErwinDataEntities" connectionString="metadata=res://*/Model.Model1.csdl|res://*/Model.Model1.ssdl|res://*/Model.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.0.11;initial catalog=ErwinData;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
      <add name="EPCEntities1" connectionString="metadata=res://*/DataModel.Model1.csdl|res://*/DataModel.Model1.ssdl|res://*/DataModel.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.0.11;initial catalog=EPC;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
      <system.web>
        <httpRuntime maxRequestLength="2097151" />
      </system.web>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
      </startup>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="v11.0" />
          </parameters>
        </defaultConnectionFactory>
      </entityFramework>
      <system.serviceModel>
        <bindings>
          <customBinding>
            <binding name="NetHttpBinding_IService1" >
              <binaryMessageEncoding  />
              <httpTransport  maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"/>
            </binding>
          </customBinding>
        </bindings>
        <behaviors>
          <endpointBehaviors>
            <behavior name="MaxBehavior">
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <client>
          <endpoint address="http://localhost:9321/Service1.svc" binding="customBinding" 
            bindingConfiguration="NetHttpBinding_IService1" contract="ServiceReference1.IService1"
            name="NetHttpBinding_IService1" />
        </client>
      </system.serviceModel>
    </configuration>

    but still I am not getting anwer

    Please help me to solve this problem

    Thanks

    Wednesday, February 20, 2013 5:54 AM

Answers

All replies