
Hi,
I am getting the following exception (after my code runs for some time and updates some records) when I run ExecuteMultipleRequest in parallel using Parallel.ForEach :
Exception thrown: 'System.ServiceModel.Security.SecurityNegotiationException' in Microsoft.Xrm.Sdk.dll
The application terminated with an error.
Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.
The request for security token has invalid or malformed elements.
My code runs properly until I set MaxDegreeOfParallelism greater than 3.
I have used "service.Timeout = new Timespan(0,30,0);"
and I have also included the following binding in app.config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding openTimeout="00:50:00"
closeTimeout="00:50:00"
sendTimeout="00:50:00"
receiveTimeout="00:50:00">
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
How can I fix this error ??
Also the authentication type for my Crm instance is AD so the SecurityTokenResponse is null for the OrganisationServiceProxy (in case this information is related to the exception).
*This post is locked for comments
I have the same question (0)Hi Ben,
The recommended MaxDegreeOfParallelism is said to be 2 for ExecuteMultipleRequest. For na on premise system , throttling is not enabled by defaut but can be set by updating the deployment properties.
"Throttling of concurrent calls – for Microsoft Dynamics 365 (online) there is a limit of 2 concurrent ExecuteMultipleRequest executions per organization. If that limit is exceeded, a “Server Busy” fault is thrown before the first request is ever executed. For an on-premises deployment, throttling is not enabled by default. The deployment setting for this limit is ExecuteAsyncPerOrgMaxConnectionsPerServer."
Refer this: https://msdn.microsoft.com/en-au/library/jj863631.aspx#limitations
Hope this helps.