Answer the question
In order to leave comments, you need to log in
Why async method in ASP.NET 5(Core) is not responding?
Hello, I ran into the following problem: there is an async method, when I send a request to it from the browser, the method is completely executed (which is written in the console) and returns a response, but the browser continues to wait for a response. If the server is stopped at this time, the browser will show the answer, if not stopped, then after a while a white screen will simply remain. How to fix it? Thank you.
(HttpGet for simplicity, then I'll change it into a post)
[HttpGet("{userName}/{password}")]
public async Task<string> Get(string userName, string password)
{
if (ModelState.IsValid)
{
var user =new ApplicationUser()
{
UserName = userName
};
var result = await usrManager.CreateAsync(user, password);
_logger.LogInformation(result.ToString());
if (result.Succeeded)
{
_logger.LogInformation(result.Succeeded.ToString());
return "{'errorCode': '0'}";
}
else
{
_logger.LogInformation(result.Errors.First().Description);
return "{'errorCode': '1','description':'"+result.Errors.First().Description+"'}";
}
}
return "Internal error.";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question