daryllabar / DLaB.Xrm.XrmToolBoxTools

Plugins for the XrmToolBox
MIT License
76 stars 69 forks source link

Problem with CRM 2016 on premises with ADFS #14

Closed AdCodicem closed 8 years ago

AdCodicem commented 8 years ago

Hello Daryl,

I use the early bound generator on the following environment : CRM 2016, on premises, with ADFS. The following exception appeared after generating the Entities files :

Executing "C:\Users\cmarty\Documents\XrmToolBox\Plugins\CrmSvcUtil Ref\crmsvcutil.exe" /url:"https://internaldevcrm2k15.identicar.fr:444/BTBDev/XRMServices/2011/Organization.svc" /namespace:"Identicar.BtB.Entities" /out:"C:\Users\cmarty\Desktop\Entities\CrmServiceContext.cs" /servicecontextname:"CrmServiceContext" /codecustomization:"DLaB.CrmSvcUtilExtensions.Entity.CustomizeCodeDomService,DLaB.CrmSvcUtilExtensions" /codegenerationservice:"DLaB.CrmSvcUtilExtensions.Entity.CustomCodeGenerationService,DLaB.CrmSvcUtilExtensions" /codewriterfilter:"DLaB.CrmSvcUtilExtensions.Entity.CodeWriterFilterService,DLaB.CrmSvcUtilExtensions" /namingservice:"DLaB.CrmSvcUtilExtensions.Entity.OverridePropertyNames,DLaB.CrmSvcUtilExtensions" /metadataproviderservice:"DLaB.CrmSvcUtilExtensions.Entity.MetadataProviderService,DLaB.CrmSvcUtilExtensions" /username:"cmarty" /password:"********" /domain:"identicar" 
CrmSvcUtil : CRM Service Utility [Version 8.0.0.7134]
¸ 2015 Microsoft Corporation. All rights reserved

Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Organization not found. Org = BTBDev/
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: Une exception a ‚t‚ lev‚e par la cible d'un appel. ---> System.Exception: Connection to CRM is not established. Aborting process.
   … Microsoft.Crm.Services.Utility.SdkMetadataProviderService.Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata()
   … DLaB.CrmSvcUtilExtensions.Entity.MetadataProviderService..ctor(IMetadataProviderService defaultService, IDictionary`2 paramters)
   --- Fin de la trace de la pile d'exception interne ---
   … System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   … System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   … Microsoft.Crm.Services.Utility.ServiceFactory.CreateInstance[TIService](TIService defaultServiceInstance, String parameterValue, CrmSvcUtilParameters parameters)
   … Microsoft.Crm.Services.Utility.ServiceProvider.InitializeServices(CrmSvcUtilParameters parameters)
   … Microsoft.Crm.Services.Utility.CrmSvcUtil.get_ServiceProvider()
   … Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
   … Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
CrmSvcUtil Error: 2 : ===== DETAIL ======
CrmSvcUtil Error: 2 : Source    : mscorlib
Method  : InvokeMethod
Date    : 15:41:58
Time    : 10/02/2016
Error   : Une exception a ‚t‚ lev‚e par la cible d'un appel.
Stack Trace : … System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   … System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   … Microsoft.Crm.Services.Utility.ServiceFactory.CreateInstance[TIService](TIService defaultServiceInstance, String parameterValue, CrmSvcUtilParameters parameters)
   … Microsoft.Crm.Services.Utility.ServiceProvider.InitializeServices(CrmSvcUtilParameters parameters)
   … Microsoft.Crm.Services.Utility.CrmSvcUtil.get_ServiceProvider()
   … Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
   … Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
======================================================================================================================
Inner Exception Level 1 : 
Source  : CrmSvcUtil
Method  : Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata
Date    : 15:41:58
Time    : 10/02/2016
Error   : Connection to CRM is not established. Aborting process.
Stack Trace : … Microsoft.Crm.Services.Utility.SdkMetadataProviderService.Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata()
   … DLaB.CrmSvcUtilExtensions.Entity.MetadataProviderService..ctor(IMetadataProviderService defaultService, IDictionary`2 paramters)
======================================================================================================================

Output file was not updated or not found!  C:\Users\cmarty\Desktop\Entities\CrmServiceContext.cs

This organization was updated from CRM 2015 and, at that time, it generated successfully the files. After the update to CRM 2016 it doesn't work anymore.

As the #12 issue's message was different I opened a new issue.

Let me know if you need more information.

danielcrenna commented 6 years ago

I should have clarified —- this was an issue with the CrmSvcUtil itself when using ADFS/IFD, and I was not using XrmToolBoxTooks; I just wanted to point out that Microsoft’s took has this bug that requires double qualifying the org name with a fake URL to work in this situation.

On Jan 25, 2018, at 3:26 PM, Daryl LaBar notifications@github.com wrote:

@danielcrenna so what url did the EBG build? Looks like org.domain.no/org is what you need? Did it at least ask you to login?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

yangs2016 commented 6 years ago

Hi, I am getting the same error when trying to run CrmSvcUtil to re-generate Dynamics proxy classes:

Executed this command against on-premise service: CrmSvcUtil.exe /out:DynamicsCRMProxy.cs /url:https://myCrm.myOrg.com/XRMServices/2011/Organization.svc /domain:myOrg /username:uid@myOrg /password:12345 /namespace:Billing.DynamicsCrm.Contracts.Proxy /serviceContextName:DynamicsProxyContext

And got this in the log: Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Organization not found. Org = XRMServices Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Unable to Login to Dynamics CRM CrmSvcUtil Error: 2 : Exiting program with exit code 2 due to exception : System.Exception: Connection to CRM is not established. Aborting process. at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.LoadMetadata(IServiceProvider service) at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run() at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args) CrmSvcUtil Error: 2 : ===== DETAIL ====== CrmSvcUtil Error: 2 : Source : CrmSvcUtil Method : LoadMetadata Date : 8:33:28 AM Time : 7/27/2018 Error : Connection to CRM is not established. Aborting process. Stack Trace : at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.LoadMetadata(IServiceProvider service) at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run() at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)

Couple of key facts: 1) I was able to browse to the Svc url and the existing codes from backend, using same connection url and credential still working fine, except for when trying to call service.CreateIncident 2) I have seen similar error when we upgraded from 2011 to 2016 but resolved it after I downloaded the MicrosoftDynamics365SDK.exe and used the CrmSvcUtil tool from the Sdk/Bin ( version is 8.2.1.8676) folder. 3) I tried a few things suggested from this board, including replacing Url with connectionString, replacing XRMServices with myOrg, etc but none of them worked at this point.

Your help will greatly appreciated. Thanks

daryllabar commented 6 years ago

What version are you running? Both of tools and CRM.

Was it working before and has stopped?

Can you connect with other SDK tools?

yangs2016 commented 6 years ago

CRM version is 8.2.2.112

and CrmSvcUtil.exe version is 8.2.1.8676

On Fri, Jul 27, 2018 at 9:35 AM, Daryl LaBar notifications@github.com wrote:

What version are you running? Both of tools and CRM.

Was it working before and has stopped?

Can you connect with other SDK tools?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daryllabar/DLaB.Xrm.XrmToolBoxTools/issues/14#issuecomment-408420084, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ7IWEfFq1DUaalQM5XsinzX5EFCCZ5nks5uKxcVgaJpZM4HXWJC .

daryllabar commented 6 years ago

I'm confused. Are you using the early bound generator, or any of it's assemblies?

yangs2016 commented 6 years ago

Yes, we've been using the CrmSvcUtil to generate all the early bound classes.

One thing was the key when we upgraded to 2016 - I had to add domain to the user name:

Before upgrading to 2016, this worked: CrmSvcUtil.exe /out:DynamicsCRMProxy.cs /url: https://crm.myOrg.com/devinstance/XRMServices/2011/Organization.svc /domain:myOrg /username:uid /password:pwd /serviceContextName:DynamicsProxyContext

After 2016, had to add domain name to user name: CrmSvcUtil.exe /out:DynamicsCRMProxy.cs /url: https://crm.myOrg.com/devinstance/XRMServices/2011/Organization.svc /domain:myOrg /username:uid@myOrg.com /password:pwd /serviceContextName:DynamicsProxyContext

On Fri, Jul 27, 2018 at 11:34 AM, Daryl LaBar notifications@github.com wrote:

I'm confused. Are you using the early bound generator, or any of it's assemblies?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daryllabar/DLaB.Xrm.XrmToolBoxTools/issues/14#issuecomment-408455665, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ7IWOCaTJmpLCcgatMuy442Nzi9Es1Qks5uKzL8gaJpZM4HXWJC .

daryllabar commented 6 years ago

@yangs2016 I don't see any DLaB assemblies in your connection string. If you're unable to connect with just the CrmSvcUtil that is a Microsoft issue. Contact them.