SharePoint 2013 – Issue Consuming AX Services

Received the following error when consuming a custom AIF service, over Net.Tcp, from SharePoint 2013 :

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:59:59.9780837′.

We had successfully consumed the service from other clients, such as a test VS project, ASP.NET page, as well as from the SharePoint’s timer job. The issue occurred only when making the call to the service when executed by the interactive SharePoint users. Turns out this has something to do with the user context/privileges. The solution was to force the SharePoint to execute the call under its application pool’s identity. Wrap the call to the service in SPSecurity.RunWithElevatedPrivileges:

SPSecurity.RunWithElevatedPrivileges(() =>


10 thoughts on “SharePoint 2013 – Issue Consuming AX Services

  1. Thanks for the comments wolftekinc.

    I am planning to create a new Enterprise portal for Dynamics Ax since the default SharePoint portal (WSS 3.0) is not satisfying our needs.

    I am currently investigating the various approaches for connecting Dynamics Ax from .NET. Could you please share your thoughts on the advantages to use SharePoint as a platform for hosting this enterprise portal than creating a classic .Net application?.

    1. It could make sense to build your application on top of SP, if your application could leverage the features that SP provides, such as collaboration ability, lists, security etc.

  2. Hi,
    Are you using the default SharePoint enterprise portal or building a custom (like normal website) on top of SharePoint from scratch?

  3. Hi Could you help to explain how to use that SPSecurity.RunWithElevatedPrivileges to call the AX AIF services and still getting the return object that we wanted ?

    SPSecurity.RunWithElevatedPrivileges(() => new AIFServiceClient().find(callContext, queryCriteria));
    how to get into the Axd object ?

Leave a Reply

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

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

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s