Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

connecting to CRM Online using Xrm.Tooling.Connector

Posted on by 1,345

Actually it work good upto yesterday, but today i could not connect below error occur

"Unable to Login to Dynamics CRMOrganizationServiceProxy is null"

*This post is locked for comments

  • Verified answer
    Iswarya Profile Picture
    Iswarya 1,345 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi,

    thanks for every suggestions, the real problem is time issue, finally change the time in server my problem resolved

  • Suggested answer
    Justinjose Profile Picture
    Justinjose 2,707 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi Iswaraya,

    can you add TLS1.2 code before calling CrmServiceClient. I have highlighted the changed section

     public class CRMService
    
       {    
    
           public IOrganizationService _orgService;      
    
           public IOrganizationService CreateConnection(string un,string pw)
    
           {
               ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
               var conn = new CrmServiceClient(GetConnectionString(un, pw));            
    
               _orgService = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;
    
               if (_orgService == null)
    
               {
    
                   return null;
    
               }
    
               return _orgService;
    
           }
    
           private string GetConnectionString(string username, string password)
    
           {
    
               try
    
               {
    
                   var connectionString = default(string);
    
                   string strOrgUrl = ConfigurationManager.AppSettings["OrganizationUri"].ToString();
    
                   try
    
                   {
    
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    
                       connectionString = "RequireNewInstance=True; Url=" + strOrgUrl + "; Username=" + username + "; Password=" + password + "; AuthType=Office365;";
    
                   }
    
                   catch (Exception ex)
    
                   {
    
                       throw;
    
                   }
    
                   return connectionString;
    
               }
    
               finally
    
               {
    
               }
    
           }
    
       }

    Thanks

    Justin Jose

  • Iswarya Profile Picture
    Iswarya 1,345 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi,

    This is my code , i already used this SecurityProtocol  but error remain same

     public class CRMService

       {    

           public IOrganizationService _orgService;      

           public IOrganizationService CreateConnection(string un,string pw)

           {

               var conn = new CrmServiceClient(GetConnectionString(un, pw));            

               _orgService = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

               if (_orgService == null)

               {

                   return null;

               }

               return _orgService;

           }

           private string GetConnectionString(string username, string password)

           {

               try

               {

                   var connectionString = default(string);

                   string strOrgUrl = ConfigurationManager.AppSettings["OrganizationUri"].ToString();

                   try

                   {

                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                       connectionString = "RequireNewInstance=True; Url=" + strOrgUrl + "; Username=" + username + "; Password=" + password + "; AuthType=Office365;";

                   }

                   catch (Exception ex)

                   {

                       throw;

                   }

                   return connectionString;

               }

               finally

               {

               }

           }

       }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi,

    It generally happens when you are using tooling connector for connection to Dynamics 365 Online.

    In order to resolve the issue you have to specify the security protocol before you make calls to your Microsoft.Xrm.Tooling assembly.

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    The connection to Dynamics 365 will not be available unless TLS12 is being used as Security Protocol.connection.

    Hope it helps.

    BR,

    Judy

    -----------------------------------

    Appreciate to Mark as Answer if it is useful.

  • Suggested answer
    Justinjose Profile Picture
    Justinjose 2,707 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi Iswarya, 

    This might be TLS1.2 issue. Please add following highlighted code before calling IOrganizationService.

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    CrmServiceClient crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["online"].ConnectionString);
    IOrganizationService _orgService = crmSvc.OrganizationWebProxyClient != null ? crmSvc.OrganizationWebProxyClient : (IOrganizationService)crmSvc.OrganizationServiceProxy;

    <connectionStrings>  
        <add name="Online" connectionString="; Username=; Password=; authtype=Office365" />
      </connectionStrings>

    Thanks

    Justin Jose

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Maybe this, then.. the TLS 1.2 requirement is relatively new, I believe.. But your Dynamics instance may have been updated recently so it may be enforced now:

    community.dynamics.com/.../unable-to-login-to-dynamics-crmorganizationserviceproxy-is-null

  • Iswarya Profile Picture
    Iswarya 1,345 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi Alex,

    i tried this one , but error remains same

  • Iswarya Profile Picture
    Iswarya 1,345 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi Alex,

    Thanks for your reply , i try this one and update you

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: connecting to CRM Online using Xrm.Tooling.Connector

    Hi,

     did you try the latest nuget package for Microsoft.CrmSdk.XrmTooling.CoreAssembly ?

     It was released 12 days ago, though, not yesterday.. so not sure if that's the problem.. But, if your code stopped working suddenly, that's the first thing I would try:

    www.nuget.org/.../9.0.0.5

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans