locked
Error connecting to Dynamics 365 online using CRM SDK following tutorial "Run a simple program using Microsoft Dynamics 365 web services" RRS feed

  • Question

  • Enter a CRM server name and port [crm.dynamics.com]: crm.dynamics.com
    Is this organization provisioned in Microsoft Office 365 (y/n) [y]: y

     Enter Username: george.kibilov@amindsolutions.com
     Enter Password: **********


    An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

    Server stack trace:
       at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
       at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.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 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Security.IWSTrustContract.Issue(Message message)
       at System.ServiceModel.Security.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.Issue(AuthenticationCredentials authenticationCredentials)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.AuthenticateInternal(AuthenticationCredentials authenticationCredentials)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.AuthenticateWithOrgIdForACS(AuthenticationCredentials authenticationCredentials, Uri identifier)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.AuthenticateOnlineFederationInternal(AuthenticationCredentials authenticationCredentials)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.Authenticate(AuthenticationCredentials authenticationCredentials)
       at Microsoft.Xrm.Sdk.Client.DiscoveryServiceConfiguration.Authenticate(AuthenticationCredentials authenticationCredentials)
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetProxy[TService,TProxy](Configuration currentConfig) in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 803
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetDiscoveryProxy() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 1023
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetOrganizationAddress() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 958
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetServerConfiguration() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 302
       at Microsoft.Crm.Sdk.Samples.CRUDOperations.Main(String[] args) in C:\MSDEV\SDK\SampleCode\CS\QuickStart\CRUDOperations.cs:line 49

    Authentication Failure

    Press <Enter> to exit.
    Tuesday, December 13, 2016 9:22 PM

Answers

  • It finally worked with original inputs:

    Enter a CRM server name and port [crm.dynamics.com]: crm.dynamics.com
    Is this organization provisioned in Microsoft Office 365 (y/n) [y]: y
     Enter Username: george.kibilov@amindsolutions.com
     Enter Password: *************

    List of organizations that you belong to:
    (1) amindsolutions.com (amindsolutions)
    Specify an organization number (1-1) [1]: 1
    Logged on user is George Kibilov.
    Microsoft Dynamics CRM version 8.2.0.729.
    account Fourth Coffee created, retrieved, and updated.
    Do you want these entity records deleted? (y/n) [y]:

    *******************

    So I was doing everything right to begin with!

    The only thing I can think of was switching to the old style admin center and clicking on Dynamics 365 triggered some setup activation process. No idea what it did, but now it works!

    • Marked as answer by GiaK Thursday, December 15, 2016 9:47 PM
    • Unmarked as answer by GiaK Thursday, December 15, 2016 9:47 PM
    • Edited by GiaK Thursday, December 15, 2016 9:50 PM
    • Marked as answer by GiaK Thursday, December 15, 2016 9:50 PM
    Thursday, December 15, 2016 9:40 PM

All replies

  • More details:

    ex {"Access is denied."} System.ServiceModel.Security.SecurityAccessDeniedException

    Is thrown from 

    > BasicOperations.exe!Microsoft.Crm.Sdk.Samples.ServerConnection.GetDiscoveryProxy() Line 1025 C#

     discoveryProxy.Execute(new RetrieveOrganizationsRequest());

    Tuesday, December 13, 2016 9:42 PM
  • It's your email should be like
    george.kibilov@amindsolutions.onmicrosoft.com


    Regards Faisal

    Wednesday, December 14, 2016 9:25 AM
  • Enter a CRM server name and port [crm.dynamics.com]: george.kibilov@amindsolutions.onmicrosoft.com
    Is this server configured for Secure Socket Layer (https) (y/n) [n]: y

    Metadata contains a reference that cannot be resolved: 'https://george.kibilov@amindsolutions.onmicrosoft.com/XRMServices/2011/Discovery.svc?wsdl&sdkversion=8'.
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
       at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Uri address, MetadataExchangeClientMode mode)
       at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary)
       at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri, Boolean enableProxyTypes, Assembly assembly)
       at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri)
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetProxy[TService,TProxy](Configuration currentConfig) in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 751
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetDiscoveryProxy() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 1023
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetOrganizationAddress() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 958
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetServerConfiguration() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 302
       at Microsoft.Crm.Sdk.Samples.CRUDOperations.Main(String[] args) in C:\MSDEV\SDK\SampleCode\CS\QuickStart\CRUDOperations.cs:line 49

    The remote name could not be resolved: 'amindsolutions.onmicrosoft.com'
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
    Press <Enter> to exit.
    Wednesday, December 14, 2016 6:53 PM
  • So after enabling DNS for my domain now it errors out differently:

    Enter a CRM server name and port [crm.dynamics.com]: crm.dynamics.com
    Is this organization provisioned in Microsoft Office 365 (y/n) [y]: y

     Enter Username: george.kibilov@amindsolutions.com
     Enter Password: *************


    Access is denied.

    Server stack trace:
       at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       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.Crm.Sdk.Samples.ServerConnection.GetDiscoveryProxy() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 1039
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetOrganizationAddress() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 958
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetServerConfiguration() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 302
       at Microsoft.Crm.Sdk.Samples.CRUDOperations.Main(String[] args) in C:\MSDEV\SDK\SampleCode\CS\QuickStart\CRUDOperations.cs:line 49
    Press <Enter> to exit.

    Thursday, December 15, 2016 2:43 AM
  • You need to provide the Organization Url.

    <orgname>.crm.dynamics.com

    Thursday, December 15, 2016 8:32 AM
  • Go to Settings

    then Developer Resources and check the URL there.


    Regards Faisal

    Thursday, December 15, 2016 10:42 AM
  • I don't see Developer Resources under Settings in Admin Center. Can you please be more specific about where I find the right URL?

    Besides, I already tried with amindsolutions.crm.dynamics.com and amindsolutions.com.crm.dynamics.com, I get same errors for both URLs:

    Enter a CRM server name and port [crm.dynamics.com]: amindsolutions.crm.dynamics.com
    Is this organization provisioned in Microsoft Office 365 (y/n) [y]: y
    Metadata contains a reference that cannot be resolved: 'https://disco.amindsolutions.crm.dynamics.com/XRMServices/2011/Discovery.svc?wsdl&sdkversion=8'.
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
       at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Uri address, MetadataExchangeClientMode mode)
       at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary)
       at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri, Boolean enableProxyTypes, Assembly assembly)
       at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri)
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetProxy[TService,TProxy](Configuration currentConfig) in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 751
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetDiscoveryProxy() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 1023
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetOrganizationAddress() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 958
       at Microsoft.Crm.Sdk.Samples.ServerConnection.GetServerConfiguration() in C:\MSDEV\SDK\SampleCode\CS\HelperCode\CrmServiceHelpers.cs:line 302
       at Microsoft.Crm.Sdk.Samples.CRUDOperations.Main(String[] args) in C:\MSDEV\SDK\SampleCode\CS\QuickStart\CRUDOperations.cs:line 49
    The remote name could not be resolved: 'disco.amindsolutions.crm.dynamics.com'
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
    Press <Enter> to exit.

    Thursday, December 15, 2016 9:28 PM
  • It finally worked with original inputs:

    Enter a CRM server name and port [crm.dynamics.com]: crm.dynamics.com
    Is this organization provisioned in Microsoft Office 365 (y/n) [y]: y
     Enter Username: george.kibilov@amindsolutions.com
     Enter Password: *************

    List of organizations that you belong to:
    (1) amindsolutions.com (amindsolutions)
    Specify an organization number (1-1) [1]: 1
    Logged on user is George Kibilov.
    Microsoft Dynamics CRM version 8.2.0.729.
    account Fourth Coffee created, retrieved, and updated.
    Do you want these entity records deleted? (y/n) [y]:

    *******************

    So I was doing everything right to begin with!

    The only thing I can think of was switching to the old style admin center and clicking on Dynamics 365 triggered some setup activation process. No idea what it did, but now it works!

    • Marked as answer by GiaK Thursday, December 15, 2016 9:47 PM
    • Unmarked as answer by GiaK Thursday, December 15, 2016 9:47 PM
    • Edited by GiaK Thursday, December 15, 2016 9:50 PM
    • Marked as answer by GiaK Thursday, December 15, 2016 9:50 PM
    Thursday, December 15, 2016 9:40 PM