Linked Questions
47 questions linked to/from HttpClient.GetAsync(...) never returns when using await/async
6
votes
1
answer
8k
views
Using httpclient in MVC application [duplicate]
When I invoke below function in a console app, it just works. But when I add the same to a MVC controller, execution never reaches JsonConvert line. Any idea, what I am missing.
Calling code
...
0
votes
1
answer
10k
views
"await HTTPClient.GetAsync" never completing [duplicate]
I had this code working in .Net Core. We realized Core wasn't the best fit for us right now, so I have been refactoring in .Net 4.5.2 and when I call
HttpResponseMessage response = await client....
2
votes
2
answers
2k
views
Why can't I run async code as synchronous [duplicate]
I am trying to understand the async/await mechanism with MVC. Now I do not consider a use case where I would go out of the "normal flow" (using either full sync or full async end-to-end). I just want ...
118
votes
4
answers
89k
views
Async call with await in HttpClient never returns
I have a call I am making from inside a xaml-based, C# metro application on the Win8 CP; this call simply hits a web service and returns JSON data.
HttpMessageHandler handler = new HttpClientHandler()...
51
votes
2
answers
31k
views
Debugger stops after async HttpClient.GetAsync() call in visual studio
I'm trying to test the follwing http request method
public async Task<HttpContent> Get(string url)
{
using (HttpClient client = new HttpClient())
// breakpoint
using (...
21
votes
2
answers
11k
views
SmtpClient.SendMailAsync causes deadlock when throwing a specific exception
I'm trying to set up email confirmation for an ASP.NET MVC5 website, based on the example AccountController from the VS2013 project template. I've implemented the IIdentityMessageService using ...
14
votes
1
answer
7k
views
Using an Async Action to Run Synchronous Code
I have a search action that has two paths, a synchronous path, that just returns a simple view, and a asynchronous path, that does the search asynchronously and then returns a view. Both are GET ...
9
votes
2
answers
9k
views
ASP.Net MVC 4 controller hangs whenever async is used
I'm using Visual Studio 2012 RC with .Net 4.5 and ASP MVC 4 RC. It hangs whenever I use async at all. The controller action method uses async but is not itself an async controller method.
There are ...
13
votes
2
answers
2k
views
How to trigger (NOT avoid!) an HttpClient deadlock
There are a number of questions on SO about how to avoid deadlocks in async code (for example, HttpClient methods) being called from sync code, like this. I'm aware of the various ways to avoid these ...
4
votes
2
answers
7k
views
Synchronous Concurrent HttpClient Usage
I am trying to use HttpClient synchronously but when I make many concurrent requests it stops working. I wrote two tests, one for asynchronous usage and one for synchronous usage. TestMethod always ...
2
votes
2
answers
7k
views
Async Method Doesn't Return
I have the following Action method that uses Scanner class which uses some webservice to get some data. When I use breakpoint inside GetSuggestions method, I can see the result. However, this data is ...
0
votes
1
answer
5k
views
HttpClient freezes on the GetStringAsync method
I have this c# MVC code and it works fine with the GetAsync and GetPost methods, but when using GetStringAsync, it freezes up at the line:
version = await client.GetStringAsync("/API/Version");
...
3
votes
2
answers
4k
views
ASP.NET Web API Client ProgressMessageHandler Post Task stuck in WinForm App
I'm using HttpClient and ProgressMessageHandler from the MS ASP.NET Web API Client Libraries.
I've happily tinkered with this in a console application without issue, but now in a WinForm app, a "Post"...
1
vote
2
answers
7k
views
Error 401 in C#
I'm working on my first app for Windows 8 but I have a problem, when I'm launch my app, I've got the error "Response status code does not indicate success:
401 (Authorization Required)
So yes, I ...
2
votes
1
answer
10k
views
httpClient.postAsync - Fire-and-Forget - Async Confusion
I have a vb console application that acts a a relay to a desktop application - posting data to an online service.
Because posts are relatively large and frequent, my intention is to 'fire and forget'....