Click here to Skip to main content
15,313,377 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to setup and use VSTS for five user Pin
Mou_kol7-Dec-17 23:19
MemberMou_kol7-Dec-17 23:19 
AnswerRe: How to setup and use VSTS for five user Pin
Richard MacCutchan8-Dec-17 0:05
mveRichard MacCutchan8-Dec-17 0:05 
QuestionVisual Studio Update 15.5.0 - MVC View editor comes up with just black text Pin
jkirkerx7-Dec-17 13:38
professionaljkirkerx7-Dec-17 13:38 
AnswerRe: Visual Studio Update 15.5.0 - MVC View editor comes up with just black text Pin
Richard Deeming8-Dec-17 1:28
mveRichard Deeming8-Dec-17 1:28 
GeneralRe: Visual Studio Update 15.5.0 - MVC View editor comes up with just black text Pin
jkirkerx8-Dec-17 6:20
professionaljkirkerx8-Dec-17 6:20 
AnswerRe: Visual Studio Update 15.5.0 - MVC View editor comes up with just black text Pin
jkirkerx10-Dec-17 10:33
professionaljkirkerx10-Dec-17 10:33 
QuestionConsuming a homemade rest service in asp.net webform Pin
wilcodk7-Dec-17 2:47
Memberwilcodk7-Dec-17 2:47 
AnswerRe: Consuming a homemade rest service in asp.net webform Pin
Richard Deeming7-Dec-17 8:54
mveRichard Deeming7-Dec-17 8:54 
You have a classic deadlock.

await signs the rest of the method up to run as a continuation when the awaited task completes. By default, it will be scheduled to run in the same execution context as the caller.

Calling .Result on a task blocks the current thread until the task has completed. But the task can't complete until the continuation has run on the current execution context. Which can't happen until the current thread is un-blocked. Which can't happen until the task has completed.

The quick-and-dirty fix is to add .ConfigureAwait(false) to your awaited tasks. That allows the continuation to run on a different thread:
C#
var liste = await client.GetManyAsync().ConfigureAwait(false);

The best solution would be to move your work to a proper task-returning async method, and register that as an async task:
C#
private void Page_Load(object sender, EventArgs e)
{
    RegisterAsyncTask(new PageAsyncTask(LoadAsync));
}

private async Task LoadAsync()
{
    List<ServerConfig> list = await Index();
    ...
}

Using Asynchronous Methods in ASP.NET 4.5[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Consuming a homemade rest service in asp.net webform Pin
wilcodk7-Dec-17 22:20
Memberwilcodk7-Dec-17 22:20 
QuestionPopulating pdf on the server Pin
Michael Clinton6-Dec-17 7:49
MemberMichael Clinton6-Dec-17 7:49 
AnswerRe: Populating pdf on the server Pin
Richard Deeming6-Dec-17 9:43
mveRichard Deeming6-Dec-17 9:43 
QuestionHow to disable gridview by checkbox? Pin
samflex4-Dec-17 7:56
Membersamflex4-Dec-17 7:56 
AnswerRe: How to disable gridview by checkbox? Pin
jkirkerx4-Dec-17 8:02
professionaljkirkerx4-Dec-17 8:02 
GeneralRe: How to disable gridview by checkbox? Pin
samflex4-Dec-17 8:48
Membersamflex4-Dec-17 8:48 
GeneralRe: How to disable gridview by checkbox? Pin
jkirkerx4-Dec-17 10:11
professionaljkirkerx4-Dec-17 10:11 
GeneralRe: How to disable gridview by checkbox? Pin
samflex4-Dec-17 10:32
Membersamflex4-Dec-17 10:32 
QuestionHow can I use CimCredential in Web Page to get Printer Status ? Pin
David Mujica28-Nov-17 7:31
MemberDavid Mujica28-Nov-17 7:31 
AnswerRe: How can I use CimCredential in Web Page to get Printer Status ? Pin
Richard Deeming28-Nov-17 8:36
mveRichard Deeming28-Nov-17 8:36 
GeneralRe: How can I use CimCredential in Web Page to get Printer Status ? Pin
David Mujica28-Nov-17 8:39
MemberDavid Mujica28-Nov-17 8:39 
GeneralRe: How can I use CimCredential in Web Page to get Printer Status ? Pin
Richard Deeming28-Nov-17 8:48
mveRichard Deeming28-Nov-17 8:48 
QuestionIIS Rewrite rule: Attach country code with all hyperlinks in page Pin
Mou_kol23-Nov-17 0:53
MemberMou_kol23-Nov-17 0:53 
Rant[REPOST] IIS Rewrite rule: Attach country code with all hyperlinks in page Pin
Richard Deeming23-Nov-17 1:01
mveRichard Deeming23-Nov-17 1:01 
QuestionLooking for MCSD Web Applications sample test Q/A Pin
Mou_kol22-Nov-17 22:12
MemberMou_kol22-Nov-17 22:12 
AnswerRe: Looking for MCSD Web Applications sample test Q/A Pin
Richard MacCutchan22-Nov-17 22:55
mveRichard MacCutchan22-Nov-17 22:55 
AnswerRe: Looking for MCSD Web Applications sample test Q/A Pin
F-ES Sitecore23-Nov-17 1:18
professionalF-ES Sitecore23-Nov-17 1:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.