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(() =>
new
<AXServiceClient>().<AXServiceOperation>());
Hi,
Are you using AIF service to pull data from dynamics Ax and display in Sharepoint?
Hi Gokul, yes, correct.
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?.
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.
Hi,
Are you using the default SharePoint enterprise portal or building a custom (like normal website) on top of SharePoint from scratch?
Hi Gokul, we’re integrating a custom SP application to AX via the AIF services.
Thanks for the comments wolfteknic
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 ?
Hi, you may want to use the delegate semantics, as in:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// implementation details omitted
});
check out the details here: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
Hi Wolftek,
Thanks, it works.