We are developing programs using the Dynamics Web API version 9.0.
There was no problem as of December 2017, but when I confirmed it on January 18, 2018, an error occurred.
----------------------------------
Error Detail:
An error occurred while sending the request
Unable to read data from transfer connection: Existing connection was forcibly disconnected to remote host.
----------------------------------
Error occurred with "httpClient.GetAsync".
----------------------------------
public async Task GetCrmUser()
{
using (HttpClient httpClient = GetHttpClient())
{
HttpResponseMessage response = await httpClient.GetAsync($"systemusers");
}
}
private HttpClient GetHttpClient()
{
HttpClient client = new HttpClient(new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate });
client.BaseAddress = new Uri(appSetting.crmWebApi);
ADALService adalService = new ADALService();
string accessToken = adalService.GetAccessToken(appSetting.authUri, appSetting.crmUri, appSetting.clientId, appSetting.userName, appSetting.password);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(con.GetConstValue(con.authenticationHeaderValue), accessToken);
if (!string.IsNullOrEmpty(callerSystemUserGuid))
{
client.DefaultRequestHeaders.Add(”Bearer”, callerSystemUserGuid);
}
return client;
}
----------------------------------
AccessToken has been acquired.
Also, it works well for instances of Dynamics 8.2 in the same tenant.
Is 9.0 no longer able to use the API in this way?
I want you to tell me something you know, if you have anything to know.
*This post is locked for comments
Sorry...
I made a mistake in one place.
It is not "Bearer" but "MSCRMCallerID".
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156