web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

plugin stops when making external webapi call

(0) ShareShare
ReportReport
Posted on by 1,299
Hi Experts,
 
I am trying to write a plugin in D365 CE to call external WebAPI in my case Business Central so i am making a call for the bearer token once and then the actual URL. But the code just exits at the place where the external call is made. I created a console application and checked and it works fine but the plugin keeps failing.
 
So i checked with a simple WebApi call but that also failed and it always fails right when it makes the external call, this works fine on a console application but fails on a plugin, below is the sample code that fails.
 
public static async Task GetbearerToken(ITracingService tracing){var client88 = new HttpClient();            client88.BaseAddress = new Uri(https://jsonplaceholder.typicode.com//);            HttpResponseMessage response88 = await client88.GetAsync(/todos/1/);            if (response88.IsSuccessStatusCode)            {                string content22 = await response88.Content.ReadAsStringAsync();            }}

I tried debugging the code, when i come to the line  HttpResponseMessage response88 = await client88.GetAsync(/todos/1/);  it exits, i have tried with var response = await client88.GetAsync(/todos/1/); it exits and it switches to the plugin registration tool with the message below, but in visual studio the process on the Diagnostic Session just goes on as it would after we attach the process to Pluginregistrationtool.exe and before we select the class file
 
 
Profiler> Plug-in AppDomain Created
Profiler> Parsed Profiler File Successfully.
Profiler> Constructor Execution Started: 09/07/2023 19:10:27
Profiler> Constructor Execution Completed Successfully (Duration = 0ms).
Profiler> Profiler Execution Started: 09/07/2023 19:10:27
Profiler> Profiler Execution Completed Successfully (Duration = 26724ms).
Profiler> Profiler AppDomain Unloaded
 
 
Please let me know if has anything changed or am i doing anything wrong, kindly help.
​
I have the same question (0)
  • Verified answer
    Davyjones Profile Picture
    1,299 on at
    Thank you very much, we got around the issue by not using async task but just the normal way

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 41 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 39

#3
Satyam Prakash Profile Picture

Satyam Prakash 35

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans