Reputation: 404
I am testing an ASP.NET Core Web Application using MVC and WebApi and Kestrel Web Server.
var host = new WebHostBuilder()
.UseKestrel(opt => opt.ThreadCount = 10)
.UseConfiguration(config)
.UseContentRoot(path)
.UseStartup<Startup>()
.Build();
For some reason when the server is processing a request it will not accept in any new requests. From what I have read this should not be the case but I cannot figure out what I am doing wrong.
Here is my WebApi controller code:
[HttpPost]
[Route("/api/test/{moduleid}")]
public Task<object> Api(string moduleId, [FromBody] JObject data)
{
return Task.Run( () =>
{
return domain.Handle(moduleId, data);
});
}
The code is not Async so I am wrapping in a Task.Run call. Everything works but the server blocks new requests until the current request finishes.
Upvotes: 1
Views: 1265
Reputation: 404
Kestrel is async by design. I was using a client that limited to one request at a time (Postman). Once I used multiple clients I saw all was well.
Upvotes: 1