0

Code Settings

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding>
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
<basicHttpBinding>
<binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="SilverlightApplication2.Web.EpriscriptionSrv">
<endpoint address="" binding="customBinding"
contract="SilverlightApplication2.Web.EpriscriptionSrv" />
<endpoint address="mex" binding="customBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Displayed error help enter image description here

Visit but did not answer

Wcf-The maximum message size quota for incoming messages (65536) has been exceeded?

enter image description here

Community
  • 1
  • 1

2 Answers2

2

Your service host config file is not the same as your client application's config.

In fact, increasing maxReceivedMessageSize does not really have any effect when placed in the server-side web.config. When your service is added as a reference in another application. It will generate a client configuration much like the one you see in your last screenshot. This, however, will often default to a message size that is typical of a smaller-scale web service.

In order to receive larger messages, you must increase the maxReceivedMessageSize attribute on your client-side configuration.

Since you are currently using the WCF Test Client I will give a couple screenshots for how to do it there:

  1. When you start up the WCF Test Client. Navigate down to "Config File", right click, and select "Edit with SvcConfigEditor".
  2. In the new configuration editor window: expand the "Bindings" menu and select your binding. Then edit the MaxReceivedMessageSize attribute. Service Config Utility screen
  3. Click File -> Save, and close the editor.
  4. On the WCF Test Client. There should now be a new pop-up stating that the configuration was modified by an outside editor, and prompting you to reload. Click "Yes" to do so. WCF Test Client Reload Menu
  5. The "Config File" menu in the WCF Test Client should now reflect the new changes. Now proceed with your test call in the WCF Test Client as normal.

When deploying this application. You will have to ensure that the client's configuration files have appropriate values in the maxReceivedMessageSize attribute in order to consume your service, but this should get the test client running for now.

cmcquillan
  • 696
  • 4
  • 12
  • 1
    Good answer - I didn't look at the config file the test client was using, but I think you've found it :) – Tim May 10 '15 at 21:31
1

You can try increasing the reader quota values on your custom binding as well.

<bindings>
  <customBinding>
    <binding>
      <binaryMessageEncoding>
        <readerQuotas maxDepth="2147483647"
                      maxStringContentLength="2147483647"
                      maxArrayLength="2147483647"
                      maxBytesPerRead="2147483647"
                      maxNameTableCharCounts="2147483647" />
        </readerQuotas>
        <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
  </customBinding>

Additionally, you may want to increase the maxItemsInGraph property for the DataContractSerializer via the behaviors:

<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true" 
                       httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <dataContractSerializer maxItemsInGraph="2147483647" />
    </behavior>
  </serviceBehaviors>
</behaviors>
Tim
  • 28,212
  • 8
  • 63
  • 76
  • System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at EpriscriptionSrv.GetAll_Patients() at EpriscriptionSrvClient.GetAll_Patients() Inner Exception: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. – user1039134 May 09 '15 at 08:38
  • Can you update your question with how your creating the proxy and making the call to `GetAll_Patients()`? The custom binding should be the default (since the `name` attribute is not there), but something is causing the increased values to not be picked up. – Tim May 09 '15 at 09:17
  • [OperationContract] public List GetAll_Patients() { List obj_Lst_t; using (var ctx = new EpriscriptionContext()) { ctx.Configuration.ProxyCreationEnabled = false; obj_Lst_t = ctx.Patients.ToList(); } return obj_Lst_t; } – user1039134 May 10 '15 at 04:28
  • public partial class Patients { public int Id { get; set; } public string FName { get; set; } public string LName { get; set; } public string FatherName { get; set; } public string IdentityNo { get; set; } public string NationalNo { get; set; } public DateTime BirthDate { get; set; } public Gender Gender { get; set; } public ActiveStatus ActiveStatus { get; set; } – user1039134 May 10 '15 at 04:32
  • public string BirthLocation { get; set; } public string ExportLocation { get; set; } public Nullable EducationalLevelId { get; set; } public EducationalLevel EducationalLevel { get; set; } public string Occupation { get; set; } public MarritalStatus MarritalStatus { get; set; } [NotMapped] public string[] Tel2 { get; set; } public string Tel { get; set; } public string Address { get; set; } public byte[] PatientImage { get; set; } [NotMapped] public string[] PatientImageAddr { get; set; } public string MedicalRecNo { get; set; } – user1039134 May 10 '15 at 04:32
  • [NotMapped] public string[] FamilyTel2 { get; set; } public string FamilyTel { get; set; } public ICollection PatientsInsurance { get; set; } public int? FamilyDoctorId { get; set; } public Therapists FamilyDoctor { get; set; } [NotMapped] public int current { get; set; } [NotMapped] public int total { get; set; } } – user1039134 May 10 '15 at 04:32
  • During the program's config file settings do not apply – user1039134 May 10 '15 at 04:35
  • problem :public ICollection PatientsInsurance { get; set; } – user1039134 May 10 '15 at 08:48
  • @user1039134 - Please edit your original question to post the code, don't post it in the comments as it won't format properly. What we really need to see is the code you are using to create the proxy (on the client end). I.e., it should look something like `Service1Client client = new Service1Client();`. We need to see if the code is doing something that is bypassing the settings in the configuration. – Tim May 10 '15 at 09:03