Hello,
I have this simple c# console application code...
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Xrm.Client;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Client.Services;
namespace QueryContact
{
class Program
{
static void Main(string[] args)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
CrmConnection con = new CrmConnection("CRMOnline");
OrganizationService service = new OrganizationService(con);
Guid gid = new Guid("67b46a03-2bad-e811-a964-000d3a3606de");
try
{
Entity account = service.Retrieve("account", gid, new ColumnSet(true));
Console.WriteLine(account.Attributes["name"]);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.ReadLine();
}
}
}
that throws this error:
Metadata contains a reference that cannot be resolved: 'xxxxxxxxxxx.crm.dynamics.com/.../Organization.svc'.
here is my app.config...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<connectionStrings>
<add name="CRMOnline" connectionString="Url=xxxxxxxxxxx.crm.dynamics.com; Username=xxxxxxxxx; Password=xxxxxxxxxx;" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Xrm.Sdk" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Xrm.Sdk.Deployment" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Xrm.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
i am sure i was able run such code on 8.2 without any issues. I'm probably getting this issue after the upgrade to 9.0 i think.
Any idea?
thanks!
*This post is locked for comments