I'm trying to connect to a remote Dynamics CRM instance and getting this exception on the ServiceClient
constructor:
Failed to connect to Dataverse
Inner Exception 1: One or more errors occurred.
Inner exception 2: Need a non-empty authority
Parameter name: Authority
The error only occurs when I move the code to a server outside my dev machine.
Here's the code:
string crmConnectionString =
$"AuthType=OAuth;Username=user@contoso.com;Password=whatever;Url=my-app.crm.dynamics.com;LoginPrompt=Never";
using (ServiceClient service = new ServiceClient(crmConnectionString)) // throws here
Through Wireshark I noticed the working server is sending the client hello using TLS v1.2, whereas the failing server is sending a slightly shorter hello using TLS v1. Could the issue be related to this and, if so, how do I fix it?