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

Community site session details

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

CRM connection timeout

(0) ShareShare
ReportReport
Posted on by 255

Hi all

I'm trying to switch to OAuth from a c# website connection to CRM online.

I see a constant timeout when trying to connect.
It seems OK in a console app though.

My test script is;

using Microsoft.Xrm.Tooling.Connector;
using System;
using System.Net;


public partial class c2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string sResult = "";
        string connectionString = "AuthType=OAuth;Username = info@xxxx.com;Password=xxxx;Url=https://xxxx.crm4.dynamics.com;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Never";
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        var service = new CrmServiceClient(connectionString);

        if (service.IsReady)
        {
            sResult = "YES";
        }
        else
        {
            sResult = "NO";
        }
        
    }
}

HELP PLEASE!

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: CRM connection timeout

    Hi,

    just try below code and let me know if error is still there.

    ServiceClient crmServiceClient = null;

    crmServiceClient = new ServiceClient(connectionString);

    Thanks,

    Arshad

    juniorazurecrm.blogspot.com/

    juniorcrmblog.blogspot.com/

    www.youtube.com/watch

  • Stuie Profile Picture
    255 on at
    RE: CRM connection timeout

    Thanks but I'm not sure how that helps.

  • Community Member Profile Picture
    on at
    RE: CRM connection timeout

    Hi,

    //using Microsoft.Xrm.Tooling.Connector;

    using Microsoft.PowerPlatform.Dataverse.Client;

    using System;

    using System.Net;

    public partial class c2 : System.Web.UI.Page

    {

       protected void Page_Load(object sender, EventArgs e)

       {  

           ServiceClient crmServiceClient = null;

           string sResult = "";

           string connectionString = "AuthType=OAuth;Username = info@xxxx.com;Password=xxxx;Url=xxxx.crm4.dynamics.com;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app:/.../58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Never";

           ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

          // var service = new CrmServiceClient(connectionString);

           crmServiceClient = new ServiceClient(connectionString);

           if (crmServiceClient.IsReady)

           {

               sResult = "YES";

           }

           else

           {

               sResult = "NO";

           }

       }

    }

  • Stuie Profile Picture
    255 on at
    RE: CRM connection timeout

    Thanks. Shouldn't CrmServiceClient work though?

  • Stuie Profile Picture
    255 on at
    RE: CRM connection timeout

    Also, I cant seem to use Microsoft.PowerPlatform.Dataverse.Client because the project .Net version is 4.6.2

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at
    RE: CRM connection timeout

    Hi,

    You will need to use MaxConnectionTimeout  property to extend the timeout. Default is 2 mins.

    docs.microsoft.com/.../microsoft.xrm.tooling.connector.crmserviceclient.maxconnectiontimeout

    ramontebar.net/.../

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Stuie Profile Picture
    255 on at
    RE: CRM connection timeout

    But should it need so long to connect?

    My application cannot really take so long to run.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 138 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 107

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 89

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans