
I created a Web-App (C#) which accesses CRM (Version 1612, 9.0.0.3172, online) using the API (Vers. 9), and a very basic console app to test some ways of handling it; HttpClient (System.Net.Http), OrganizationWebProxyClient (Microsoft.Xrm.Sdk.WebServiceClient) & OrganizationServiceProxy(Microsoft.Xrm.Sdk.Client).
Everything worked fine before Christmas, however, nothing worked when it got back last week.
All methods threw the following exception (Fiddler):
“HTTPS handshake to <instance>.api.crm4.dynamics.com (for #<No.>) failed. System.IO.IOException..”
I found an article about TLS 1.0 and 1.1 being blocked, so I changed the target framework from 4.6.1 to 4.7.1, httpRuntime targetFramework from 4.6.1 to 4.7, updated everything in NuGet and added ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12.
OrganizationServiceProxy seems to work now.
OrganizationWebProxyClient throws the following exception:
“POST request requires Content-Type application/json”.
The request header contains ‘Content-Type: text/xml; charset=utf-8’.
HttpClient gives me:
“HTTP Error 401 - Unauthorized: Access is denied”
This call works if I add Bearer to the header. However, I didn’t even specify a Bearer before Christmas (I’m guessing that I should have).
I also noticed that I’m getting “HTTP Error 401 - Unauthorized: Access is denied” instead of being redirected to the login-page when I try to access the CRM API directly from my browsers without first going to CRM.
I’ve tried to create everything from scratch incl. AAD setup, but nothing seems to work.
Am I using the wrong assemblies (OrganizationWebProxyClient)?
Should I even be able to use HttpClient, without directly specifying Bearer, to access the Web API? Even when it’s used in a Web App registered in AAD, and having permissions for Dynamics CRM Online?
Hoping that someone might point me in the right direction.
*This post is locked for comments
I have the same question (0)