Click here to Skip to main content
16,017,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Client A and Client B. They communicate through WCF Service.

I am trying to send huge text(15000 characters), but WCF Service is not getting this data.

But when I send 8100 characters of text, WCF Service gets the data, and send to client B.

Please tell me how to solve this issue...

below is my Web.config:

XML
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name ="WcfService.Service1" >
        <endpoint address ="" binding ="wsDualHttpBinding" contract ="WcfServiceLibrary.IMyService"/>
         <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress ="http://localhost/Service1.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <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>

</configuration>




CLient A code(Button click code where I am sending Data)

C#
DataMessage message = new DataMessage();
                message.Age = &quot;
                string Xml = _DataResult;
                message.Name = Xml.ToString();


Client B code(Where textbox gets the result from WCF Service)
C#
this.label1.Text = eventData.Age;
            this.textBox1.Text = eventData.Name;


DataMember in WCF:
C#
[DataMember]
        public string Name { get; set; }
[DataMember]
        public string Age { get; set; }


What I have tried:

Please suggest me how to solve this Issue
Posted
Updated 24-May-16 6:12am
v2

At service section add bindingConfiguration element to your endpoint with wsDualHttpBinding:
XML
<endpoint address="" binding="wsDualHttpBinding" bindingconfiguration="myBindingConfig" contract="WcfServiceLibrary.IMyService" />

To root of system.serviceModel section add bindings section with configuration like this:
XML
<bindings>
    <wsDualHttpBinding>
        <binding name="myBindingConfig" maxReceivedMessageSize="25000" />
    </wsDualHttpBinding>
</bindings>
 
Share this answer
 
v3
Comments
Member 12478311 24-May-16 12:20pm    
@Mad Russian...It didn't Work..
Welcome in the wcf world.... that's why i don t use it anymore, because you have so much surprise in production when you don t know the size of what you will receive...

look in option in the binding ,
you have maxReceivedMessageSize,maxBufferSize,maxBufferPoolSize,readerQuotas to set,
here is an example :
XML
<basichttpbinding>
    <binding name="basicHttp" allowcookies="true">
             maxReceivedMessageSize="10000000"
             maxBufferSize="10000000"
             maxBufferPoolSize="10000000"
        <readerquotas maxdepth="32">
             maxArrayLength="100000000"
             maxStringContentLength="100000000"
    </readerquotas></binding>
</basichttpbinding>
 
Share this answer
 
v2
Comments
Member 12478311 24-May-16 12:29pm    
@roks nicolas..It didn't Work..
roks nicolas 25-May-16 4:22am    
well i hope you did'nt just copy/past my up example configuration but adapt it to your config has Mad russian suggest...
have you got an exception ? activate exception routing by setting includeexceptiondetailinfaults="true" in the config

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900