Frequent connections terminated exceptions when using CRM 2013

I have a problem starting a WCF service that connects to CRM: it often calls CommunicationObjectAbortedExceptions, which leaves me wondering if I am doing something wrong. These launches began after many people started using it; it worked without problems in the test system.

But let's start from the beginning: I wrote two WCF services that connect to the Microsoft CRM2013 organization service, using my own library to run CRM requests. These services are regularly called from CRM, which is used daily by approximately 100-200 people.

This works mostly fine, but I often get a couple of exceptions that look like this (see the bottom of the post for the full table):

System.ServiceModel.CommunicationObjectAbortedException: The HTTP request for " http://crm/MyOrganization/XRMServices/2011/Organization.svc" was aborted. This may be due to the closure of the local channel while the request is still ongoing. If this behavior is not desired, update the code so that it does not close the channel while query operations are in progress.

Often I mean about 100 times a day, most often a couple of these exceptions are thrown every 5-30 minutes in batches of 3-6 exceptions. I have no idea why this is happening. I initialize the connection to the CRM organization service using the following class from my library in both services:

public class CrmManager : IDisposable
{
    private static CrmConnection s_connection;
    public static CrmConnection Connection
    {
        get
        {
            if (s_connection == null)
            {
                s_connection = new CrmConnection("CrmTvTest");
            }
            return s_connection;
        }
    }

    public static IOrganizationService ServiceProxy
    {
        get { return s_serviceProxy ?? (s_serviceProxy = new CachedOrganizationService(Connection)); }
    }

, WCF-, CrmConnection , ( , ). CachedOrganizationService, . WCF (PerSession AFAIK), , , , 1 .

My Connection String ( , ):

<connectionStrings>
    <add name="CrmTvTest" connectionString="Url=http://crm/MyOrganization; Username=user; Password=pw;"/>

CrmServiceContext CrmManager. , , using:

using (CrmServiceContext context = new CrmServiceContext(CrmManager.ServiceProxy))
{
    // do some stuff...
}

? , , CRM, , CrmConnection. .

, - .


1

Developer Extensions CrmConnector, ( ). CrmConnection CrmServiceContext:

using (CrmServiceContext context = new CrmServiceContext(CrmManager.Connection))

, , ( , , .


:

--- > System.Net.WebException: : .     System.Net.HttpWebRequest.GetResponse()     System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(- TimeSpan)    --- ---

:     System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest, HttpAbortReason abortReason)     System.ServiceModel.Channels.HttpChannelFactory 1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.SecurityChannelFactory 1.SecurityRequestChannel.Request( , - TimeSpan)     System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object [] ins, Object [] outs, TimeSpan timeout)     System.ServiceModel.Channels.ServiceChannelProxy.InvokeService( IMethodCallMessageCall, ProxyOperationRuntime)     System.ServiceModel.Channels.ServiceChannelProxy.Invoke( )

, [0]:     System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData & msgData, Int32-)     Microsoft.Xrm.Sdk.IOrganizationService.Execute( OrganizationRequest)     Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore( OrganizationRequest)     Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute( OrganizationRequest)     Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection( OrganizationRequest, NavigationSource)     Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, , NavigationSource, 1 linkLookups, String& pagingCookie, Boolean& moreRecords) at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List 1 linkLookups)     Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute [TElement] ( )     Microsoft.Xrm.Sdk.Linq.QueryProvider.System.Linq.IQueryProvider.Execute [TResult] ( )     System.Linq.Queryable.SingleOrDefault [TSource] ( IQueryable`1)     CrmConnector.Entities.Contact.Get(Guid p_id, Boolean p_includeRelatedEntities) j:\IntDev\Libraries\CrmConnector\Entities\Contact.cs: 63     CrmExtensionService.CrmExtension.GetPersonalizedEmailSignature(String p_contactId, String p_systemUserId) j:\IntDev\Services\CrmExtensionService\CrmExtension.svc.cs: 460

+1
1

, : CRM FrontEnd . , CRM, . CRM- 1, 2 .

- , , , .

StackOverflow : , - . webHttpBinding basicHttpBinding, (, , ).

0

All Articles