Custom service Buffer issue

I am getting error “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.”
Steps to reproduce

  1. We created an application in .Net which contains Web reference to Sales Force system and Axapta net Tcp reference to connect to Axapta. The whole
    purpose of this kind of setup is to pull customers from Sales force and Sync into Axapta.

  2. When we run this application in .Net we are able to sync customers successfully.

  3. We created reference in Axapta and called this application for sync, we started getting error “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.” This was working fine
    earlier but seems the number of customers have increased over a period of time.

  4. We have increased the buffer size parameters in app.config file in .Net. We also increased the buffer size values in inbound ports (By stopping
    service and clicking on configure button). But no help.

Can anyone please suggest what to be done.

pastedimage1481913739346v1.png

The message talks about the limit of received message size, but you said you increased some buffer size. Didn’t you intentionally change some other parameter? Also, to which value have you increased it.

Nevertheless if you increase the limit to suffice today, maybe you’ll get more customers tomorrow and you’ll run into the same problem again. This solution doesn’t scale. A better design is splitting the data to several smaller parts (= paging). You might be interested in the fact that paging is already supported by the query service, which is likely a better choice for your tasks than developing a custom service.

Thanks Martin for valuable reply.
Client wanted Custom service. For this, I infact changed the buffer by selecting a small set of customers by applying filter to retrieve only those customers which are created or updated in last 3 days. The set of customers has reduced from 1000 to less than 10. Still i am getting buffer issue. I have run through all processes (Deploying object in .Net, running CIL in Ax, restarting AOS, clearing cache and everything). It seems somewhere else i am missing something. I have been into 10 days of searching the fix. Can you please put some more light from your experience what can else be done in this case? Thanks in advance.

Your client is a software architect? Interesting… Clients usually wants partners to help them with analyzing business requirements and defining the best technical solution, after taking into account all requirements, limitations and options offered by Dynamics AX.

You’re saying “buffer issue”, but the error you mentioned above is about MaxReceivedMessageSize. Please confirm that you mean MaxReceivedMessageSize when talking about buffer. If you got another error about too large table buffer, it’s a completely different topic.

If you do mean MaxReceivedMessageSize, I unfortunately can’t tell you what bug you have in your code that leads to sending much more data than expected. You can debug your code and use WCF tracing to learn more about what’s going on.

Actually client already had this solution in Production. There was need to increase the number of columns for customer which are fetched from SFDC. So there might be reluctance in implementing a different solution. However i have used query service to fetch data from Ax into .Net but here i have to create customer into Axapta. Can you share some link for the same(Using query service writting tables in Axapta). May be if custom service don’t work then i can propose this solution. Thanks for your help.

Query service is for querying, not for creating new records. The usual solution for creating new records is using the out-of-the-box document service called CustCustomerService (although you surely can write a custom service, if you insist). Note that you can use the query service for running queries and fetching huge amount of records, and different types of services for insert, updates and deletes.

If I may return back to the topic, could you explain what you mean by “buffer issue”? If you have a problem with a table buffer in AX (in addition to exceeding WCF message size), you’ll have to address it regardless of the type of service.

Using what the client already has in production is a good idea, unless it actually doesn’t the job.

Buffer Issue: We are getting MaxReceivedMessageSize error only. I believe when number of customers that are fetched are increased we start getting this error.

Strange thing is it works in .Net when run directly. However when this application is called in Axapta it gives this error. Even if i call insert and update service (existing services) still i am thinking the above error will remain.

Oh, I see, you aren’t talking about a custom service in AX sense at all. You’re consuming an external service.

If it works “in .Net when run directly”, something must be different in that case. First of all, check if the service returns the same data (maybe you don’t use the same parameters, for example, or something else is different).
If you get the same data and it works in your .NET app and fails in AX, I think they don’t use the same configuration. Make sure that configuration files are identical and that you create the service client in AX with AifUtil::CreateServiceClient() (which loads the config file).

Nevertheless as I said, merely increasing the limit isn’t scalable. Your service should have the capability to return large data sets in smaller chunks. (A significantly more advanced solution would be data streaming.)