Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Dynamics Web API v9.0 Error Occured

Posted on by

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

  • Skmtkt Profile Picture
    Skmtkt on at
    RE: Dynamics Web API v9.0 Error Occured

    Sorry...

    I made a mistake in one place.

    It is not "Bearer" but "MSCRMCallerID".

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans