Home > CRM 2011, Misc > The maximum array length quota has been exceeded – Error in WCF service

The maximum array length quota has been exceeded – Error in WCF service

Hi,

I was getting below exception when I call a WCF service from my plug – in

There was an error deserializing the object of type XYZ. The maximum array length quota (16384) has been exceeded while reading XML data

Below was my requirement,

  • I have to send emails with attachments from my plugin
  • So I built a custom WCF Email service
  • From the plug-in we are calling service method by passing object

I have no clue about the error, because I already given maximum reader quote values in my service configuration (Refer below)

Service Configuration:- 

Binding:-

<basicHttpBinding>

<binding name=”basicHttp_EmailService” openTimeout=”00:30:00″

receiveTimeout=”00:30:00″ sendTimeout=”00:30:00″ maxBufferSize=”2147483647″

maxBufferPoolSize=”2147483647″ maxReceivedMessageSize=”2147483647″>

<readerQuotas

maxDepth=”2147483647” maxStringContentLength=”2147483647

maxArrayLength=”2147483647” maxBytesPerRead=”2147483647

maxNameTableCharCount=”2147483647

/>

Service

<service name=”EmailService“>

After spending couple of hard hours I found the reason & fix for the issue

Reason:-

  • My service is simply ignoring my binding “basicHttp_EmailService” and it’s always taking default binding
  • Reason is
    • My configuration service name does not match with service name in Service Host
    • The name I given is “EmailService” where it has to be “XYZ. EmailService”

Fix :-

  • Right click your “.svc” file and choose “View Markup”
  • Copy the Service name and paste it in your service name
WCF Service Host

WCF Service Host

  • Now my Service configuration looks below

<service name=”XYZ.EmailService“>

🙂

Advertisement
  1. Prajakta
    November 2, 2013 at 3:21 AM

    Thank you !

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: