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)

Unable to login to dynamics CRM

(1) ShareShare
ReportReport
Posted on by

I got the following exception when trying to connect to Dynamics CRM using connection string as belows

CrmServiceClient conn = new Xrm.Tooling.Connector.CrmServiceClient(connectionString);

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

Exceptions:

Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : ERROR REQUESTING ORG
S FROM THE DISCOVERY SERVER
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Source      : mscorl
ib
Method  : HandleReturnMessage
Date    : 6/8/2017
Time    : 4:29:17 PM
Error   : Access is denied.
Stack Trace     : Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
 reply, MessageFault fault, String action, MessageVersion version, FaultConverte
r faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt
ime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on
eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim
eout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall
Message methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
   at Microsoft.Xrm.Sdk.Discovery.IDiscoveryService.Execute(DiscoveryRequest req
uest)
   at Microsoft.Xrm.Sdk.Client.DiscoveryServiceProxy.Execute(DiscoveryRequest re
quest)
   at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.DiscoverOrganizations(Uri discov
eryServiceUri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCred
entials deviceCredentials)
================================================================================
======================================

Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : No Orgs Found, Searc
hed Online. Region Setting = IND
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Unable to Login to D
ynamics CRM
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : OrganizationServiceP
roxy is null
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : OrganizationWebProxy
Client is null

*This post is locked for comments

I have the same question (0)
  • Samrando Profile Picture
    270 on at

    check out the links if they can help

    msdn.microsoft.com/.../mt608573.aspx;MSPPError=-2147217396

    msdn.microsoft.com/.../jj602970.aspx

  • Gopalan Bhuvanesh Profile Picture
    11,401 on at

    Hi

    would you please provide the connection string?

  • Community Member Profile Picture
    on at

    <add name="Server=xxxxx.crm8.dynamics.com, organization=XXXXX, user=bhavik.shah@XXXX.com"

            connectionString="Url=xxxxx.crm8.dynamics.com; Username=bhavik.shah@XXXXX.com; Password=XXXXXX; AuthType=Office365; "/>

  • Community Member Profile Picture
    on at

    Is this issue still occurring. Did you find a solution?

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Try see if this works using the CrmServiceClient with the individual parameters. CrmServiceClient class has 9 function overrides.

    It seems like you are using CRM Online, so try the following:

    CrmServiceClient conn = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(userName, ConvertToSecureString(CRM_PASSWORD), "NorthAmerica", orgName, isOffice365: true);

    The ConvertToSecureString function is as follows:

           private System.Security.SecureString ConvertToSecureString(string password)

           {

               if (password == null)

                   throw new ArgumentNullException("missing pwd");

               var securePassword = new System.Security.SecureString();

               foreach (char c in password)

                   securePassword.AppendChar(c);

               securePassword.MakeReadOnly();

               return securePassword;

           }

  • JohnLeme Profile Picture
    355 on at

    Where you able to find a solution? My app was working JUST fine until CRM 365 update yesterday. Now I got this same error. The code is fine, just as latest SDK.

  • Community Member Profile Picture
    on at

    I have this issue when trying to connect to a trial instance using the simplified connection in the SDK quick start. The instance is in the UK (crm11) . I have tried using the org name found in the developer resources of the crm instance and tried suggestions in this post.

    How did you resolve this ?

  • JohnLeme Profile Picture
    355 on at

    The SDK samples are using old DLLs version 8.0. Make sure you have the latest packages/DLLs on your project.

  • Suggested answer
    Eugen Profile Picture
    70 on at

    That worked for me. Thanks!

    Seems MS didn't bother to update the sample code within the new SDK package.

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Check the version of the dll files in the SDK. If you are using CRM 2016, you should be using assembly version 8.0 or 8.1. If you are using Dynamics 365, you should be using 8.2.

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