web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

[CrmClientService] System.TimeoutException: The request channel timed out while waiting for a reply after 00:14:59.9969996

(0) ShareShare
ReportReport
Posted on by 32

Hi there,

I am using CrmClientService to connect to Dynamics 365 to retrieve data.

But I always encountered this kind of error. the stack message is

System.TimeoutException: The request channel timed out while waiting for a reply after 00:14:59.9969996. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'xxxx.crm6.dynamics.com/.../web has exceeded the allotted timeout of 00:14:59.9990000. The time allotted to this operation may have been a portion of a longer timeout. ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

I try to set the timeout value to 30 mins like below (the value is timespan of 30 minutes), but not working. the error still said timout due to 15 mins exceeds

if (InternalCrmServiceClient.OrganizationServiceProxy != null)
{
    InternalCrmServiceClient.OrganizationServiceProxy.Timeout = value;
}
if (InternalCrmServiceClient.OrganizationWebProxyClient != null
    && InternalCrmServiceClient.OrganizationWebProxyClient.Endpoint != null
    && InternalCrmServiceClient.OrganizationWebProxyClient.Endpoint.Binding != null)
{
    InternalCrmServiceClient.OrganizationWebProxyClient.Endpoint.Binding.SendTimeout = value;
}
CrmServiceClient.MaxConnectionTimeout = value;

Please note, here 'InternalCrmServiceClient' is actually a instance of CrmServiceClient

Any suggestions?

I have the same question (0)
  • PerezAguiar Profile Picture
    Microsoft Employee on at

    Hey Flex!

    The issue seems to be here related to the deprecation of the OrganizatonServiceProxy classes.  This is documented on docs.microsoft.com/.../important-changes-coming and on docs.microsoft.com/.../authenticate-office365-deprecation.  Please ensure that your code is updated and using the appropriate authentication method.

    Regards

  • Flex Xuan Profile Picture
    32 on at

    Hi Daniel,

    Thanks for your reply.

    We noticed the deprecation of the OrganizationServiceProxy, so we are not using it. we are using OAuth authentication type as Microsoft suggested.

    Actually, in the code shows above, InternalCrmServiceClient.OrganizationServiceProxy is always null.

    Any other suggestions?

  • PerezAguiar Profile Picture
    Microsoft Employee on at

    Hey!


    if OrganizationServiceProxy is always null ,first 10 lines are not doing anything (condition is not being met).

    on Line 11 shouldn't it be InternalCrmServiceClient.MaxConnectionTimeout = Value;

    The other important thing is that perhaps the MaxConnectionTimeOut value should be set before creating the instance.  I've seen a nice code on https://ramontebar.net/2020/03/18/crmserviceclient-proxy-timeout/

    Regards

  • Flex Xuan Profile Picture
    32 on at

    Thanks Daniel,

    MaxConnectionTimeout is a static property, so cannot set the value as you said.

    But what remind me is that you mentioned "the value should be set before creating the instance", I will give a try.

  • mickmiles Profile Picture
    10 on at

    Thanks for this question and solution. A dedicated software development (SAD) team https://mlsdev.com offers custom software development services tailored to a client's business requirements. The dedicated software development firm normally provides complete web development as well as software engineering services. In addition, they offer consultancy services, technical support and product support for small and medium enterprises (SMEs). There are two types of dedicated software development firms - software engineering services firms and software development service firms. These are the types of firms that you should choose to look for when you are looking to avail custom software development services.

  • Flex Xuan Profile Picture
    32 on at

    Hi Daniel,

    I tried to set the value before new the instance. but still got the error.

    System.TimeoutException: The request channel timed out while waiting for a reply after 00:15:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'xxx.crm6.dynamics.com/.../web has exceeded the allotted timeout of 00:15:00. The time allotted to this operation may have been a portion of a longer timeout. ---> System.Net.WebException: The operation has timed out

    at System.Net.HttpWebRequest.GetResponse()

    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

    --- End of inner exception stack trace ---

    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)

    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

    --- End of inner exception stack trace ---

    Server stack trace:

    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:

    at Microsoft.Xrm.Tooling.Connector.CrmServiceClient.Execute(OrganizationRequest request)

    at Framework.DynamicsCRM.Providers.OrgService.CrmOrganizationService.Execute[T](OrganizationRequest request, Boolean needRetry, Int32 retryCount, Int32 sleepSeconds)

  • Giorgio Zanoni Profile Picture
    74 on at

    I have exactly the same problem.

    Did you figure out to solve it?

    Thanks in advance

  • Suggested answer
    Pradeep Rai Profile Picture
    5,489 Moderator on at

    Hi,

    I am using below code to connect the CRM service from my C# console app.

     public static IOrganizationService GetOrganisationService()
            {
                CrmServiceClient _crmConnection;
                string connectionString = string.Empty;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                connectionString = ConfigurationManager.ConnectionStrings["CRMServices"].ConnectionString;
    
                _crmConnection = new CrmServiceClient(connectionString);
                if (_crmConnection.OrganizationWebProxyClient != null)
                {
                    _crmConnection.OrganizationWebProxyClient.ChannelFactory.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 5, 0);
                    _crmConnection.OrganizationWebProxyClient.ChannelFactory.Endpoint.Binding.SendTimeout = new TimeSpan(0, 5, 0);
                }
    
                if (_crmConnection.OrganizationServiceProxy != null)
                {
                    _crmConnection.OrganizationServiceProxy.Timeout = new TimeSpan(0, 5, 0);
                }
    
                IOrganizationService _orgService = (IOrganizationService)_crmConnection.OrganizationWebProxyClient != null ? (IOrganizationService)_crmConnection.OrganizationWebProxyClient : (IOrganizationService)_crmConnection.OrganizationServiceProxy;
    
                return _orgService;
            }
    
        }

    And below library used in code:

    pastedimage1634112244240v1.png

    Thanks,
    Pradeep.

    Please mark this as VERIFIED if it helps.

  • Suggested answer
    Flex Xuan Profile Picture
    32 on at

    Yes, Solved.

    All you need to do is set

    CrmServiceClient.MaxConnectionTimeout = value;

    before you get the instance of CrmServiceClient.

  • Giorgio Zanoni Profile Picture
    74 on at

    I'm trying to amend my code... If it works I'll set your answer as verified.

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 98

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 60 Super User 2025 Season 2

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans