I am creating a web application (asp.net) in Visual Studio 2017 that will retrieve data from Microsoft Dynamics 365 (CRM). This is version 9, ON-PREMISE.
I am developing the app on my workstation. When I run it in debug mode, it runs on the localhost and the connection to CRM via the SDK works fine as I get the data from CRM as expected. To further test the application I deployed it to a web server on our network (the same server CRM is running on). This server is a Windows 2016 Standard box. The website runs but it can't connect to CRM. The "LastCRMError" is "Unable to log into CRM. Access Denied." Remember, it logs in fine from my workstation.
We are using ADFS for authentication, which is also on-premise.
I've spent two entire days searching for an answer, and trying everything that I have found, all to no avail. So now I am posting here in hopes that someone out there will have an answer.
Here are the relevant pieces of code:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
CrmServiceClient client = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRMConnectionURL"].ConnectionString);
if (client.IsReady) <-- This always comes back as false
{
Connection string in web.config:
connectionString="Url=https://<server>.<domain>.com/CRM; Username=domain\username; Password=password;" <-- I've tried this with and without the "AuthType" tag. When using it I've tried "AD", "IFD", and "oAuth." No difference.
In my VS project, I installed the SDK via NuGet, which is the only way you can get the latest version now.
Apologies if this is the wrong forum and if so, it would be great to be recommended to the correct forum.
Thanks in advance.