Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection error OnlineFederation #21

Closed
MikeGWright opened this issue Feb 24, 2016 · 7 comments
Closed

Connection error OnlineFederation #21

MikeGWright opened this issue Feb 24, 2016 · 7 comments

Comments

@MikeGWright
Copy link

When creating a connection with the latest XRMToolBox to an online instance that uses federated AD or Azure AD (see "Known Issue" at https://github.com/MscrmTools/XrmToolBox/wiki/Connecting-to-a-Microsoft-Dynamics-CRM-deployment), the connection needs to use the unique org name instead of the named alias.

Everything connects fine this way, but the generated command line ends up using the named alias for the URL instead of the unique name, eg 'https://customernameDev.crm... instead of https://customername0.crm.... Copying the generated command line and updating the URL parameter to use the unique org name makes everything work.

Here is the stack trace that it kicks back:
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Unable to Login to Dynamics CRM
Unable to Login to Dynamics CRM
CrmSvcUtil Error: 2 : Exiting program with exit code 2 due to exception : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Connection to CRM is not established. Aborting process.
at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata()
at DLaB.CrmSvcUtilExtensions.Entity.MetadataProviderService..ctor(IMetadataProviderService defaultService, IDictionary`2 paramters)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Crm.Services.Utility.ServiceFactory.CreateInstance[TIService](TIService defaultServiceInstance, String parameterValue, CrmSvcUtilParameters parameters)
at Microsoft.Crm.Services.Utility.ServiceProvider.InitializeServices(CrmSvcUtilParameters parameters)
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
CrmSvcUtil Error: 2 : ===== DETAIL ======
CrmSvcUtil Error: 2 : Source : mscorlib
Method : InvokeMethod
Date : 10:04:16 AM
Time : 2/24/2016
Error : Exception has been thrown by the target of an invocation.
Stack Trace : at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Crm.Services.Utility.ServiceFactory.CreateInstance[TIService](TIService defaultServiceInstance, String parameterValue, CrmSvcUtilParameters parameters)
at Microsoft.Crm.Services.Utility.ServiceProvider.InitializeServices(CrmSvcUtilParameters parameters)
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()

at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)

Inner Exception Level 1 :
Source : CrmSvcUtil
Method : Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata
Date : 10:04:16 AM
Time : 2/24/2016
Error : Connection to CRM is not established. Aborting process.
Stack Trace : at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata()

at DLaB.CrmSvcUtilExtensions.Entity.MetadataProviderService..ctor(IMetadataProviderService defaultService, IDictionary`2 paramters)

@daryllabar
Copy link
Owner

Have you tried the lastest pre-release version?

@MikeGWright
Copy link
Author

That's the one I used. I just downloaded again to verify and it's still throwing the same error.

@daryllabar
Copy link
Owner

And what version does it say it is?

@MikeGWright
Copy link
Author

1.2016.2.23

@daryllabar
Copy link
Owner

I'm using the OrganizationServiceUrl from the mscrmtools2001.config. When I connect to my online environment, it looks like this:
https://orgGENERATEDVALUE.api.crm.dynamics.com/XRMServices/2011/Organization.svc

<ConnectionDetail>
      <AuthType>OnlineFederation</AuthType>
      <ConnectionId>021e0ff9-95c8-42ed-aa47-5d77f802d421</ConnectionId>
      <ConnectionName>Defender Dev</ConnectionName>
      <IsCustomAuth>true</IsCustomAuth>
      <UseIfd>false</UseIfd>
      <UseOnline>true</UseOnline>
      <UseOsdp>true</UseOsdp>
      <UserDomain></UserDomain>
      <UserName>myUserName@MyDomain.com</UserName>
      <UserPassword>MyEncryptedPassword</UserPassword>
      <SavePassword>true</SavePassword>
      <UseSsl>true</UseSsl>
      <ServerName>orgGENERATEDVALUE.crm.dynamics.com</ServerName>
      <ServerPort>443</ServerPort>
      <OriginalUrl>https://orgGENERATEDVALUE.crm.dynamics.com</OriginalUrl>
      <Organization>orgGENERATEDVALUE</Organization>
      <OrganizationUrlName>orgGENERATEDVALUE</OrganizationUrlName>
      <OrganizationFriendlyName>My Friendly Env Name</OrganizationFriendlyName>      
    <OrganizationServiceUrl>https://orgGENERATEDVALUE.api.crm.dynamics.com/XRMServices/2011/Organization.svc</OrganizationServiceUrl>
      <OrganizationDataServiceUrl>https://defcrmsandbox3.api.crm.dynamics.com/XRMServices/2011/OrganizationData.svc</OrganizationDataServiceUrl>
      <OrganizationVersion>7.1.1.4458</OrganizationVersion>
      <HomeRealmUrl></HomeRealmUrl>
      <Timeout>1200000000</Timeout>
      <WebApplicationUrl>https://friendlyName.crm.dynamics.com/</WebApplicationUrl>
      <LastUsedOn>02/25/2016 08:26:19</LastUsedOn>
    </ConnectionDetail>

What does yours look like? Can you try editing your file?

@MikeGWright
Copy link
Author

Editing the file did the trick. The 'OriginalUrl' had the generated org name, but the OrganizationServiceUrl had the alias name. I changed OrganizationServiceUrl and OrganizationDataServiceUrl in the file to match the generated org name and connected. Once it connected it reset the data service URL to the original name, but left ServiceUrl alone and everything worked like a charm.

Thanks very much both for the awesome tool and your prompt attention, both are very much appreciated!

-Mike

@daryllabar
Copy link
Owner

No Problem. Glad we figured it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants