title: .NET Web Application Async call working locally from VS workspace code, but not from server
body: <p>I have written code to get data from an API. I am using an Async method to handle the call and processing of the retrieved data. The code is triggered by the user clicking a Login button on their Start page. While the Async method is running in the background, the user is redirected to another .NET web application page, their Homepage.</p>
  <p>All of the code works perfectly when I build and run the website locally from VS, the data is returned and my code processes the data, adding it to various SQL tables.</p>
  <pre><code>myApiIntegration.Log($&quot;GetDataFromAPI({querystring}, {displayInConsole}): Getting data from API&quot;)
  
  Dim response As HttpResponseMessage = Await myApiRequest.GetResponse(querystring)
  
  ' only continue if request was successful, otherwise log an error
  If Not response.IsSuccessStatusCode Then
        myApiIntegration.Log(&quot;ERROR: API request failed: &quot; &amp; response.ReasonPhrase)
        Return Nothing
  Else
        myApiIntegration.Log(&quot;API request successful&quot;)
  ...
  
  </code></pre>
  <p>I have checked my code in to a Test server. The site builds, and thanks to some logging I've put in, I can see that my code is triggered when the user clicks the Login button, right up to the API call itself: I can see the Request object is being initialised using the correct headers etc. The last log message I can see is created by the last line before the API call itself. The user is still redirected to their homepage.</p>
  <p>After that, I cannot see any messages from my Async code. The next message I would expect to see would be either &quot;API call successful&quot; or &quot;API call failed&quot;, depending on the response from the API (these are messages I'm logging from my code via Graylog, and again, they work locally); but there are no further messages, following the one telling me it is about to make the API call.</p>
  <p>I have checked the server logs for errors. There are none at the time of logging in and running the API code.
  I have asked our Infrastructure guy to checked the firewall for messages - he couldn't see any - but he couldn't see any when the request was sent out from my local code either (and this worked).
  I have checked that my code is identical on my local workspace copy and on the server. It is.</p>
  <p>Could anyone advise me what I should be looking at, what might be wrong, or what other avenues I could try? It's a Windows Server 2016 Datacenter VM. The application is a .NET Framework web app, written in VB.NET.</p>