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 :
Microsoft Dynamics CRM (Archived)

connecting to CRM Online using Xrm.Tooling.Connector

(0) ShareShare
ReportReport
Posted on by 1,347

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

I have the same question (0)
  • ashlega Profile Picture
    34,477 on at

    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

  • Iswarya Profile Picture
    1,347 on at

    Hi Alex,

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

  • Iswarya Profile Picture
    1,347 on at

    Hi Alex,

    i tried this one , but error remains same

  • ashlega Profile Picture
    34,477 on at

    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

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at

    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

  • Community Member Profile Picture
    on at

    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.

  • Iswarya Profile Picture
    1,347 on at

    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

               {

               }

           }

       }

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at

    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

  • Verified answer
    Iswarya Profile Picture
    1,347 on at

    Hi,

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

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans