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.

daryllabar commented 8 years ago

Looks like your error is "Connection to CRM is not established. Aborting process." Have you tried rerunning it?

AdCodicem commented 8 years ago

Yes I tried several times. Recently I had to write a console app : I used microsoft.xrm.client.dll and the CrmConnection class. When my organization was on CRM 2015, it worked perfectly but since I updated to CRM 2016 a similar error appeared in relation with the security token. In order to resolve this I used the Microsoft.Xrm.Tooling.Connector.dll and it worked again.

I think it is the same issue, can you confirm ?

daryllabar commented 8 years ago

Are you trying the plugin with the latest version of the XrmToolBox, or are you using the full version that contains the XrmToolBox? I just want to verify that you can connect with another tool in the tool box, but not with the EarlyBoundGenerator.

AdCodicem commented 8 years ago

I try with the plugin with the latest version of the XrmToolBox. Other plugins like Web Resources Manager are working fine.

daryllabar commented 8 years ago

So it can connect fine, but the CrmSvcUtil cannot. Did you do a copy and replace? I'm wondering if there is something in the CrmSrvUtil Ref folder that is from a previous version... You are using the 2016.2.6.1 version of the EarlyBoundGenerator Correct?

daryllabar commented 8 years ago

I don't have any control of how the CrmSvcUtil.exe connects to CRM. You can attempt to turn on Tracing for it

<system.diagnostics> 
   <trace autoflush="false" indentsize="4"> 
      <listeners> 
         <add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener"> 
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" /> 
         </add> 
      </listeners> 
   </trace> 
</system.diagnostics>
AdCodicem commented 8 years ago

Indeed, I did a copy and replace and also use the 2016.2.6.1 version. I turned on tracing but there is no additionnal informations, I suppose it's a bug in the CrmSvcUtil.exe which may be resolved later.

daryllabar commented 8 years ago

Can you verify that the URL in the Mscrmtools2001.config for OrganizationServiceUrl contains your Organization Unique name, vs the friendly version. https://github.com/MscrmTools/XrmToolBox/issues/299#issuecomment-169771747

AdCodicem commented 8 years ago

I tried the 2 versions (https://myOrg.domain.com:444 and https://serverName.domain.com:444/myOrg) but none are functionning.

However, with the friendly version the error is different :

Executing "C:\Users\cmarty\Documents\XrmToolBox\Plugins\CrmSvcUtil Ref\crmsvcutil.exe" /url:"https://btbdev.identicar.fr:444/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:"********" 
CrmSvcUtil : CRM Service Utility [Version 8.0.0.7134]
¸ 2015 Microsoft Corporation. All rights reserved

Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (North America) URI is = https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (Europe, Middle East and Africa) URI is = https://disco.crm4.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (Asia Pacific Area) URI is = https://disco.crm5.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (South America) URI is = https://disco.crm2.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (Oceania) URI is = https://disco.crm6.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (Japan) URI is = https://disco.crm7.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (North America 2) URI is = https://disco.crm9.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (Canada) URI is = https://disco.crm3.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Exception while trying to connect Discovery Server, (India) URI is = https://disco.crm8.dynamics.com/XRMServices/2011/Discovery.svc
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : No Orgs Found, Searched Online. Region Setting = 
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    : 09:18:35
Time    : 15/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    : 09:18:35
Time    : 15/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
daryllabar commented 8 years ago

If you log into CRM, and go to developer Extensions, what is the format of the organization service URL?

AdCodicem commented 8 years ago

It's the following format https://serverName.domain.com:444/orgName/XRMServices/2011/Organization.svc and it leads to the first error message.

daryllabar commented 8 years ago

Have you tried replacing the "orgName" in your url with org unique name? I know this is different for CRM online, not sure for on prem.

7e205a0c-b577-11e5-8355-40b7b7332199 1

ghost commented 8 years ago

Hi. Im having the exact same issue. Other plugins works just fine. Same happens with CRM 2013 and 2016. Any clues to what could be the problem?

Thanks!

AdCodicem commented 8 years ago

On on premises, the unique id is equal to the org name.

daryllabar commented 8 years ago

@BackToTheCrm and @Kasperpurunen, I don't have access to an On Prem Environment to test. I'm using the standard CrmSrvUtil.exe in order to connect, so there are 3 possibilities. They have a bug ( usually not very likely), I'm generating the incorrect URL, or I'm missing the correct DLL dependencies.

The Log in the UI of Early Bound Generator spits out the Command Line that is executed (Minus masking the password) Can one or both of you take that Command Line, and see if you can get it to work via the standard cmd.exe? There are two formats listed on MSDN:

  1. CrmSvcUtil.exe /url:https://myport:555/MyOrg/XRMServices/2011/Organization.svc
  2. CrmSvcUtil.exe /url:https://myorg.crm.com:555/XRMServices/2011/Organization.svc

I'm generating the first option I believe, maybe I need to be generating the 2nd for your instances.

Thanks for submitting the issue and for any trouble shooting you do to support the community.

AdCodicem commented 8 years ago

I have tested the two formats via cmd.exe but none are working. The error displayed is the same as in my first comment but if I remove the domain argument, the second error is displayed.

Personnally I think it's a bug in the CrmSrvUtil.exe. As I said before I had a similar error with a console app I wrote which was fixed by using the new assembly (Microsoft.Xrm.Tooling.Connector.dll) to connect to the CRM.

daryllabar commented 8 years ago

The new version of the CrmSrvUtil.exe is using the Microsoft.Xrm.Tooling.Connector.dll. If you navigate to XrmToolBox\Plugins\CrmSvcUtil Ref\CrmSvcUtil.exe, what version is it?

AdCodicem commented 8 years ago

It's the version 8.0.0.7134. I tested other way to connect and it seems that the following command works : CrmSvcUtil.exe /out:entitie.cs /connectionstring:"Url=https://serverName.domain.com:444/orgName;Domain=myDomain;UserName=cmarty;Password=*****;AuthenticationType=AD"

ghost commented 8 years ago

I have the same version as @BackToTheCrm.

daryllabar commented 8 years ago

So there is an issue with the CrmSvcUtil v8.0.0 8134? connecting to CRM on prem? Is it IFD deployments or as standard adfs?

daryllabar commented 8 years ago

I mean standard AD?

AdCodicem commented 8 years ago

It's an IFD deployment. I try other connection string and it appears that AuthenticationType is not mandatory. Furthermore, the https://orgName.domain.com:444/ format doesn't work while the https://serverName.domain.com:444/orgName format works.

I think the simpler fix could be to use the /connectionstring: argument instead of the /url:, /username:, /password: and /domain: arguments.

daryllabar commented 8 years ago

Ok, so if I change it to spit out https://serverName.domain.com:444/orgName, it should work for IFDs?

If you don't specify a userid or password for ADFS it'll just default to your network credentials. This works great for your case, but not for CRM Online.

AdCodicem commented 8 years ago

In my case, if I don't specify my credentials then an exception is fired. I'm sorry but I doesn't understand your first sentence can you explain it in another way ?

On my environment the following command works : CrmSvcUtil.exe /out:entitie.cs /connectionstring:"Url=https://serverName.domain.com:444/orgName;Domain=myDomain;UserName=username;Password=*****" And this command doesn't work : CrmSvcUtil.exe /out:entitie.cs /url:"https://serverName.domain.com:444/orgName" /domain:"myDomain" /username:"username" /password:"*****"

daryllabar commented 8 years ago

I use the XTB connection to create the command line parameters. I'll update it to create a connection string instead of specifying the url, domain, username, and password separately. Although I'll have to make sure I escape the password correctly...

daryllabar commented 8 years ago

I'm attempting to build this, but unfortunetly without an environment to test, this may take forever. @BackToTheCrm or @KasperPurunen would you be willing to give me an account to test with, or perhaps getting the latest code and ensuring that it works? I've built a new version that I think should output exactly what you you list @BackToTheCrm: My Best Guess

AdCodicem commented 8 years ago

I can't give you an access because it's my client's environment. I tested the version you give but it doesn't work, here is the log :

Executing "C:\Users\cmarty\Downloads\XrmToolBoxADFS\Plugins\CrmSvcUtil Ref\crmsvcutil.exe" /namespace:"CrmEarlyBound" /out:"C:\Users\cmarty\Downloads\XrmToolBoxADFS\Plugins\CrmSvcUtil Ref\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.NamingService,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

Options:
 /nologo
  Suppresses the banner.

 /language:<language>
  The language to use for the generated proxy code.  This can be either 'CS' or 'VB'.  The default language is 'CS'.  Short form is '/l:'.

 /url:<url>
  A url or path to the SDK endpoint to contact for metadata.

 /out:<filename>
  The filename for the generated proxy code.  Short form is '/o:'.

 /namespace:<namespace>
  The namespace for the generated proxy code.  The default namespace is the global namespace.  Short form is '/n:'.

 /interactivelogin:
  Presents a login dialog to loginto the service with, if passed all other connect info is ignored.  Short form is '/il:'.

 /connectionstring:
  Connection String to use when connecting to CRM. If provided, all other connect info is ignored.  Short form is '/connstr:'.

 /username:<username>
  Username to use when connecting to the server for authentication.  Short form is '/u:'.

 /password:<password>
  Password to use when connecting to the server for authentication.  Short form is '/p:'.

 /domain:<domain>
  Domain to authenticate against when connecting to the server.  Short form is '/d:'.

 /serviceContextName:<service context name>
  The name for the generated service context. If a value is passed in, it will be used for the Service Context.  If not, no Service Context will be generated

 /help
  Show this usage message.  Short form is '/?'.

 /generateActions
  Generate wrapper classes for custom actions  Short form is '/a'.

 /deviceid:<deviceid>
  Device ID to use when connecting to the online server for authentication.  Short form is '/di:'.

 /devicepassword:<devicepassword>
  Device Password to use when connecting to the online server for authentication.  Short form is '/dp:'.

Example:
crmsvcutil.exe /url:http://localhost/Organization1/XRMServices/2011/Organization.svc /out:GeneratedCode.cs

Output file was not updated or not found!  C:\Users\cmarty\Downloads\XrmToolBoxADFS\Plugins\CrmSvcUtil Ref\CrmServiceContext.cs

You don't pass either the connectionstring arg or the url arg. Besides the username, password and domain args still remain. In my case, only the connectionstring arg containing the Url, UserName, Password and Domain works.

daryllabar commented 8 years ago

Ok, I'm not sure what the settings are from the XTB Connection Info that apply to your situation. Here is a new version that will spit out some info from the XTB connection information so I can see what flags I need to check for. Thanks for you continued willingness to trouble shoot this. Hopefully I can use the logging from this one to make the changes need to allow for the correct Connection String generation, and the next one will at least spit out what you're saying works.

AdCodicem commented 8 years ago

You're welcome ! Here is the log :

ActiveDirectory
https://servername.domainname.com:444/BTBDev/XRMServices/2011/Organization.svc
False
Executing "C:\Users\cmarty\Downloads\XrmToolBoxDebug\Plugins\CrmSvcUtil Ref\crmsvcutil.exe" /url:"https://internaldevcrm2k15.identicar.fr:444/BTBDev/XRMServices/2011/Organization.svc" /namespace:"CrmEarlyBound" /out:"C:\Users\cmarty\Downloads\XrmToolBoxDebug\Plugins\CrmSvcUtil Ref\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.NamingService,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    : 14:28:32
Time    : 17/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    : 14:28:32
Time    : 17/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\Downloads\XrmToolBoxDebug\Plugins\CrmSvcUtil Ref\CrmServiceContext.cs
daryllabar commented 8 years ago

Ok, I assumed it was a Federation Authentication, but it's AD. I've updated to look for that, and so this one should get closer to what we need...

AdCodicem commented 8 years ago

We're getting closer but there is still a little bug:

CRM Authentication Type Detected: ActiveDirectory
https://internaldevcrm2k15.identicar.fr:444/BTBDev/XRMServices/2011/Organization.svc
True
Executing "C:\Users\cmarty\Downloads\XrmToolBoxDebug2\Plugins\CrmSvcUtil Ref\crmsvcutil.exe" /namespace:"CrmEarlyBound" /out:"C:\Users\cmarty\Downloads\XrmToolBoxDebug2\Plugins\CrmSvcUtil Ref\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.NamingService,DLaB.CrmSvcUtilExtensions" /metadataproviderservice:"DLaB.CrmSvcUtilExtensions.Entity.MetadataProviderService,DLaB.CrmSvcUtilExtensions" connectionstring="Url=https://internaldevcrm2k15.identicar.fr:444/BTBDev/XRMServices/2011/Organization.svc;Domain=identicar;UserName=cmartyPassword=********" 
CrmSvcUtil Error: 2 : Exiting Microsoft.Crm.Services.Utility.ICommandLineArgumentSource.OnInvalidArgument: Found string connectionstring=Url=https://internaldevcrm2k15.identicar.fr:444/BTBDev/XRMServices/2011/Organization.svc;Domain=identicar;UserName=cmartyPassword=******** in arguments array that could not be parsed.

The connectionstring= part must be remplaced by /connectionstring:, and there is a semicolon missing between the username value and the Password key. I think it will be OK then.

daryllabar commented 8 years ago

I'm keeping my fingers crossed (Is that a universal sign of good luck?) on this one

AdCodicem commented 8 years ago

At least, in France, it's a sign of good luck ! I tested and there is an error, I managed to make it works by :

daryllabar commented 8 years ago

Take 4?5?6?

I added the deployment dll and removed the 2011 endpoint URL

AdCodicem commented 8 years ago

I'll test it on friday.

daryllabar commented 8 years ago

Sounds Good @BackToTheCrm! @KasperPurunen I have a potential fix if you want to try it.

ghost commented 8 years ago

@daryllabar Sounds lovely. I'll try it during the day and report back. Thanks!

diverjoe commented 8 years ago

I was able to successfully create individual entity files on the cmd line using the following command --AND-- copying the CrmSvcUtil.exe from the currently downloadable SDK from MS. The file date and versions are older that what is shipping in the Full download.
EBG - 8.0.0.0000.8174 2/4/2016 10:15Pm SDK - 8.0.0.0000.2074 12/7/2015 8:03 AM

As another data point, I also had trouble getting the Filter project in the SDK to build because of version mis-matches.

CrmSvcUtil.exe /url:http:////XRMServices/2011/Organization.svc /out:e:\Entities\Entities.cs /username:***** /password:***** /domain:**** /namespace:Xrm.Plugins.Common.Entities /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"

diverjoe commented 8 years ago

BTW we are on 2016 On-Prem - non-IFD

daryllabar commented 8 years ago

My version of the CrmSvcUtil comes from the NuGet packages. So it's newer than the version in the Crm Sdk?

diverjoe commented 8 years ago

Seems so

diverjoe commented 8 years ago

here is the url I used: https://www.microsoft.com/en-us/download/details.aspx?id=50032

AdCodicem commented 8 years ago

Good news @daryllabar ! The take 4 is OK !

daryllabar commented 8 years ago

Resolved with 2016.2.18.1

AdCodicem commented 8 years ago

Hi @daryllabar ! The pre-release 2016.2.18.1 doesn't contain the fix.

Edit: Sorry it's an error.

mariusso commented 7 years ago

I get the following with version 1.2016.9.10 on CRM 2016 on-prem with IFD (I have edited username, org and domain):

CRM Authentication Type Detected: Federation Executing "C:\Users\username\Desktop\XrmToolBox\Plugins\CrmSvcUtil Ref\crmsvcutil.exe" /url:"https://org.domain.no/XRMServices/2011/Organization.svc" /generateActions /out:"C:\Users\username\Desktop\XrmToolBox\Plugins\CrmSvcUtil Ref\Actions.cs" /namespace:"CrmEarlyBound" /codecustomization:"DLaB.CrmSvcUtilExtensions.Action.CustomizeCodeDomService,DLaB.CrmSvcUtilExtensions" /codegenerationservice:"DLaB.CrmSvcUtilExtensions.Action.CustomCodeGenerationService,DLaB.CrmSvcUtilExtensions" /codewriterfilter:"DLaB.CrmSvcUtilExtensions.Action.CodeWriterFilterService,DLaB.CrmSvcUtilExtensions" /username:"username" /password:"**" /domain:"domain" CrmSvcUtil : CRM Service Utility [Version 8.1.0.7711] c 2015 Microsoft Corporation. All rights reserved

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.Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata() 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 : Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata Date : 12:50:45 Time : 27.10.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 Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()

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

Output file was not updated or not found! C:\Users\username\Desktop\XrmToolBox\Plugins\CrmSvcUtil Ref\Actions.cs

danielcrenna commented 6 years ago

For those who come after, it's counterintuitive, but you can get around this flaw by specifying the orgname both in the subdomain and in the path for IDF+ADFS deployments:

https://**org**.domain.no/**org**/XRMServices/2011/Organization.svc

daryllabar commented 6 years ago

@DanielCrenna is this something that is currently broken? This thread is pretty old.

danielcrenna commented 6 years ago

@daryllabar Yes, I encountered this issue yesterday with the latest CrmSvcUtil from NuGet.

On Jan 24, 2018, at 11:02 PM, Daryl LaBar notifications@github.com wrote:

@danielcrenna is this something that is currently broken? This thread is pretty old.

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

daryllabar commented 6 years ago

@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?