scottdurow / SparkleXrm

An open-source library for building Dynamics CRM XRM solutions using Script#, jQuery & Knockoutjs.
MIT License
265 stars 197 forks source link

unable to connect spkl to 9.x API, online #185

Open aappddeevv opened 6 years ago

aappddeevv commented 6 years ago

I get an error when trying to create a connection to a 9.x system. Not sure its spkl, but it could be related. XXX are placeholders for my server name:

Is this organization provisioned in Microsoft Office 365 (y/n) [y]: y
The application terminated with an error.
Metadata contains a reference that cannot be resolved: 'https://disco.XXX.crm.dynamics.com/XRMServices/2011/
Discovery.svc?wsdl&sdkversion=8.2'.
   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 enableProx
yTypes, Assembly assembly)
   at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri)
   at Microsoft.Crm.Sdk.Samples.ServerConnection.GetProxy[TService,TProxy](Configuration currentConfig)
   at Microsoft.Crm.Sdk.Samples.ServerConnection.GetDiscoveryProxy()
   at Microsoft.Crm.Sdk.Samples.ServerConnection.GetOrganizationAddress()
   at Microsoft.Crm.Sdk.Samples.ServerConnection.GetServerConfiguration()
   at SparkleXrmTask.Program.Run(CommandLineArgs arguments)
   at SparkleXrmTask.Program.Main(String[] args)
Unable to connect to the remote server
Press any key to continue . . .
scottdurow commented 6 years ago

What version of spkl are you using? Version v1.0.119.1 is compiled against the v9 SDK.

aappddeevv commented 6 years ago

1.0.178.1. I just installed it based on what sprkl.exe prints out.

scottdurow commented 6 years ago

Could you try Install-Package spkl -Version 1.0.196-beta

aappddeevv commented 6 years ago

Tried it (sdkversion=9). That did not work. Same error. Maybe its not the sdversion part.

I ran a curl on it and I think that its trying to hit the wrong destination. Should it be disco.crm.dynamics.com (for me in NA) vs disco.URL.crm.dynamics.com or something else like that?

scottdurow commented 6 years ago

Have you tried connecting to an 8.2 org in the same tenant if you have one?

aappddeevv commented 6 years ago

I just tried it, same result on an 8.2 orcg. But the beta still used v9, So I went back to 178 to get 8.2 and still had the same error. My windows login does not match the online id.

aappddeevv commented 6 years ago

If its a "me" issue, don't spend any more time on this. But my xxx.crm.dynamics.com seems fine as I can log into it via the browser.

ziffo777 commented 6 years ago

Hi, Did you manage to fix this issue? I have the same problem. Thank you.

lukasbelak commented 6 years ago

I hope @scottdurow will read this. Could you recompile project with target framework 4.6.2 please and push new version to nuget?

Have a look at https://blogs.msdn.microsoft.com/crminthefield/2017/11/08/dynamics-365-monthly-update-october-2017/

scottdurow commented 6 years ago

Can you try the latest beta - https://www.nuget.org/packages/spkl/1.0.196-beta

lukasbelak commented 6 years ago

thanks Scott, it works now with v9

devkeydet commented 6 years ago

I'm getting this same error when trying to call earlybound.bat. I am using https://www.nuget.org/packages/spkl/1.0.196-beta. When I point it to a v8.x instance it works. When I point it to a v9.x instance, it doesn't. Here is my spkl.json:

"earlyboundtypes": [ { "entities": "account,contact,quote", "generateOptionsetEnums": true, "generateStateEnums": true, "generateGlobalOptionsets": true, "filename": "EarlyBoundTypes.cs", "classNamespace": "TestPlugin", "serviceContextName": "XrmSvc" } ] }

scottdurow commented 6 years ago

@devkeydet Do you get the issue with https://www.nuget.org/packages/spkl/1.0.196-beta ?

devkeydet commented 6 years ago

Yes [REMOVED EMAIL SIGNATURE NOISE]

scottdurow commented 6 years ago

Can you make sure you have no folders with the 8.x assemblies in them in the packages folder please?

devkeydet commented 6 years ago

That was it!

michaeljcarlton commented 6 years ago

I get exactly the same issue when connecting to Online instances either v8 or v9. I can connect to on prem instances ok but not online.

I only have v9 packages in the packages folder (vanilla install of spkl 1.0.198 installs the Microsoft.CrmSdk.CoreTools.8.2.0.5 package which i updated to 9.0.0.7).

Any suggestions? We are really keen to include spkl in our projects.

Is this organization provisioned in Microsoft Office 365 (y/n) [y]: y
The application terminated with an error.
Metadata contains a reference that cannot be resolved: 'https://disco.xx.crm4.dynamics.com/XRMServices/2011/Discovery.svc?wsdl&sdkversion=9'.
   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)
   at Microsoft.Crm.Sdk.Samples.ServerConnection.GetDiscoveryProxy()
   at Microsoft.Crm.Sdk.Samples.ServerConnection.GetOrganizationAddress()
   at Microsoft.Crm.Sdk.Samples.ServerConnection.GetServerConfiguration(Boolean ignoreLocalPrincipal)
   at SparkleXrmTask.Program.Run(CommandLineArgs arguments)
   at SparkleXrmTask.Program.Main(String[] args)
Unable to connect to the remote server
scottdurow commented 6 years ago

Make sure you are using the latest prerelease (https://www.nuget.org/packages/spkl/1.0.214-beta)

michaeljcarlton commented 6 years ago

Thanks @scottdurow - i found the reason, and looking back at the comment from @aappddeevv i think they may have had the same issue. When asked for the server name and port i was using <orgname>.<region>.dynamics.com when the connection helper is expecting <region>.dynamics.com.

I re-tried using crm4.dynamics.com and all is working really well. Kind of obvious when you read the output from the tool, but you might want to add a note in the tool output to explain what is expected when using Dynamics 365 online.

Thank you!

olusparks commented 6 years ago

Thanks @michaeljcarlton - I was doing the same mistake until I read your comment. The issue has been resolved. Silly me!!