Hi everybody,
We upgraded our Dynamics Version from v7.0.3 to v8.2.28.
To do this, we created a new infrastructure of servers based on dynamics v8.2.28, similar to the real one (run platform). We exported the organization from run platform and imported it into the new infrastructure.
All functionalities were tested and worked well with some users (between 5 and 10) connected. However, when more (> 80) users were connected to Dynamics, it doesn't work correctly : a lot of null objects returned by "new CRMServiceClient(...)".
We have this error (in French, sorry !) :
System.ServiceModel.CommunicationObjectAbortedException: La demande HTTP à 'crmoz.imha.local/.../Organization.svc' a été annulée. La raison peut en être que le canal local a été fermé alors que la demande était toujours en cours. Si ce comportement n'est pas souhaité, effectuez une mise à jour du code de façon à ce qu'il ne ferme pas le canal alors que des opérations de demande sont toujours en cours. ---> System.Net.WebException: La demande a été abandonnée : La demande a été annulée.
à System.Net.HttpWebRequest.GetResponse()
( Our translation : The HTTP Request to 'crmoz.imha.local/.../Organization.svc' aborted. The reason could be that the local connection was closed while still running. If this behaviour is not expected, please update the code in order to it doesn't close while running). --> System.Net.WebException: The request was abandonned : The request was aborted to System.Net.HttpWebRequest.GetResponse() )
Is there a limit of the number of connection we can use (in a lap of time), via CRMServiceClient ?
Why a "crmService = new CrmServiceClient(...)" can return a null object, from time to time (or randomly) ?
Is there some logs we can find inside Dynamics to show why these connections are refused / dropped ?
Our Framework .Net : 4.8
.Net Windows Server version : 2012R2
Dynamics Server version : 2016
SQL Server : 2016
Code used :
public AssistantSDK()
{
string url = ConfigurationManager.AppSettings["CRM_UrlSoap"];
string domaine = ConfigurationManager.AppSettings["CRM_Domain"];
string nomUtilisateur = ConfigurationManager.AppSettings["CRM_Username"];
string motDePasse = ConfigurationManager.AppSettings["CRM_Password"];
try
{
crmService = new CrmServiceClient($"AuthType=AD;Url={url}{domaine};Username={nomUtilisateur};Password={motDePasse};RequireNewInstance=True;");
try
{
if (!crmService.IsReady && crmService != null)
{
Log.Error($"Connection not ready, LastCrmError: {crmService.LastCrmError}");
if (crmService.LastCrmException != null) { Log.Error($"LastCrmException : {crmService.LastCrmException}"); }
Log.Info($"Retry connection CrmServiceClient : AuthType=AD;Url={url}{domaine};Username={nomUtilisateur};Password=;RequireNewInstance=True;");
crmService = new CrmServiceClient($"AuthType=AD;Url={url}{domaine};Username={nomUtilisateur};Password={motDePasse};RequireNewInstance=True;");
if (!crmService.IsReady && crmService != null)
{
Log.Error($"Retry connection : CrmServiceClient not ready {crmService.LastCrmError}");
if (crmService.LastCrmException != null) { Log.Error($"LastCrmException : {crmService.LastCrmException}"); }
}
}
}
catch (Exception ex)
{
if (crmService != null)
{
Log.Error($"Impossible de créer une connexion LastCrmError: {crmService.LastCrmError}", ex);
if (crmService.LastCrmException != null) { Log.Error($"LastCrmException : {crmService.LastCrmException}", ex); }
}
else
{
Log.Error("Erreur à la création de la connexion à la CRM", ex);
}
}
}
catch (Exception ex)
{
if (crmService != null)
{
Log.Error($"LastCrmError : {crmService.LastCrmError}", ex);
if (crmService.LastCrmException != null) { Log.Error($"LastCrmException : {crmService.LastCrmException}", ex); }
}
else
{
Log.Error("Erreur à la création de la connexion à la CRM", ex);
}
}
}
The call :
using (var AssistantSdk = new AssistantSDK())
{
// Récupération des personnes
EntityCollection collectionPersonnes = AssistantSdk.ExecuterRequeteFetch(fetchPersonne);
...
}