Thursday, August 16, 2012

Dynamics AX 2012 Excel Add-in – Issues and Solutions (Timeout issues)

Microsoft Dynamics AX 2012 Excel Add-in – Issues and Solutions (Timeout issues)

Purpose: The purpose of this document is to outline some issues you may encounter when using Dynamics AX 2012 Excel Add-in for import of data and provide solutions to resolve them.

Issue: 'Method 'System.ServiceModel.CommunicationObjectFaultException.Detail' not found'.

Issue: 'The request channel timed out attempting to send after 00:10:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout'.

Issue: 'The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:10:00'.

Reason: This issue occurs because Client-side and/or Server-side binding has insufficient Timeout value settings for sending/receiving of messages.    

Dynamics AX Error
This error is the result of unhandled exception which was re-thrown (2nd level exception), the meaningful exceptions (1st level exceptions) are presented below 



Solution: Appropriate Client-side and/or Server-side binding Timeout value settings for sending/receiving of messages will be increased to handle bigger volumes of data which takes more time, in particular ReceiveTimeout and SendTimeout settings. Please note that you specify Server-side (AOS) binding settings using Microsoft Dynamics AX 2012 Configuration Utility (Client Configuration Utility) > Connection tab > Configure Services button > Microsoft WCF Service Configuration Editor, and you specify Client-side (Adapter) binding settings using Inbound port > Configure button > Microsoft WCF Service Configuration Editor.

Important: Please note that it is recommended to use Microsoft Dynamics AX 2012 DMF (Data Migration Framework) for data migration with large volumes of data because DMF allows for much better performance comparing to Excel Add-in.

In this particular case the issue was caused by Client-side binding Timeout settings which were increased appropriately. You can see the example of Client-side config file if you use WCF Test Client utility to test your Web Service

WCF Test Client

This Client config file (Client.dll.config) is generated from scratch by WCF Test Client utility every time you add Web Service to it for testing. Please see binding settings highlighted with Green below  

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_BudgetTransactionService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
                <binding name="NetTcpBinding_GeneralJournalService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://ax2012-a:8201/DynamicsAx/Services/OfficeAddins"
                binding="netTcpBinding" bindingConfiguration="NetTcpBinding_BudgetTransactionService"
                contract="BudgetTransactionService" name="NetTcpBinding_BudgetTransactionService">
                <identity>
                    <servicePrincipalName value="host/AX2012-A.contoso.com" />
                </identity>
            </endpoint>
            <endpoint address="net.tcp://ax2012-a:8201/DynamicsAx/Services/OfficeAddins"
                binding="netTcpBinding" bindingConfiguration="NetTcpBinding_GeneralJournalService"
                contract="GeneralJournalService" name="NetTcpBinding_GeneralJournalService">
               <identity>
                    <servicePrincipalName value="host/AX2012-A.contoso.com" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

You can change Server-side configuration (AOS) using Microsoft Dynamics AX Configuration Utility > Configure Services button

Microsoft Dynamics AX Configuration Utility

Microsoft Service Configuration Editor

NetTCPBinding Before and After
Before
After

You can change Client-side configuration (Adapter) using Inbound form > Configure button
  
Inbound port

Microsoft Service Configuration Editor

NetTCPBinding Before and After
Before
After

After you increase appropriate Client-side and/or Server-side binding Timeout value settings for sending/receiving of messages you can publish bigger volumes of data into Microsoft Dynamics AX 2012 using Excel Add-in

Result

In this particular case using Microsoft Dynamics AX 2012 Demo VM I published 3000 General journal lines (and 1 General journal header) using General journal Web Service and it took about 50 minutes (it's more than default timeouts). Please set up appropriate Filter on Excel spreadsheet in advance to prevent the system from retrieving all General journal headers/lines for display upon completion of import because this data retrieval by itself may take more time than actual import.

    

Important: Please note that Excel Add-in calls Web Service asynchronously which means that even if you receive exception in Excel Add-in and control is passed back to Excel Add-in with no indication about the result of import, the import process may still be going on background in Worker thread and you will see the result of import after a period of time (in my case it could be 50 minutes). You can also explicitly see these Worker threads on Online users form.


Please note that if you enable Logging on Inbound Port you will explicitly see both Request and Response messages logged in History form, so you can also see exactly the time when import started and when it was completed.

Inbound port

History

Important: Please note that depending on Microsoft Dynamics AX 2012 build you use KB2632761 may have to be installed in order for Excel Add-in to take into account Client-side Binding settings.



Tags: Dynamics ERP, Dynamics AX 2012, Excel, Dynamics AX 2012 Excel Add-in, Data Import, Data Conversion, Data Migration, Application Integration Framework, Issue, Problem, Solution, Resolution.

Note: This document is intended for information purposes only, presented as it is with no warranties from the author. This document may be updated with more content to better outline the issues and describe the solutions.

Author: Alex Anikiev, PhD, MCP

5 comments:

  1. Hi Alex, your blog is very helpful on our data migration process. Thank you.
    Now I've got almost similar error like this post, while trying import using General Journal Services :
    Method 'System.ServiceModel.QuotaExceededException.Detail' not found.
    I'm not sure which binding I should increase?

    ReplyDelete
  2. Hi,
    I was faced a problem with "The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. " But in my ax 2012 - dynamics ax 2012 configuration-> Configuration services in Readonly. wht to do now

    ReplyDelete
  3. Go -> Manage -> Create Configuration -> Give it a name -> apply
    Now you can edit any settings you like.

    ReplyDelete
  4. I have this issue, but the process doesn't work for me :S When I use the utility I get the error again "timeout", even when I have changed the values there are somthing aditional to do?.

    ReplyDelete
  5. Once I had this issue at my office, when the system went down and I couldn't get the back up data working.
    Luckily, the support team fixed the problem quickly.
    In my opinion, despite some errors, ax dynamics is the best software choice for any growing company, and the dynamics 365 implementation is quite easy too.

    ReplyDelete