K
K
Kirill Zhilyaev2020-01-03 00:05:32
.NET
Kirill Zhilyaev, 2020-01-03 00:05:32

How to handle multiple requests at the same time?

I'm learning a little C#. There is a code:

public async Task<int> Get()
        {
            await Task.Delay(5000);
            return Thread.CurrentThread.ManagedThreadId;

        }


2 requests are being made. The problem is that the requests are executed sequentially. Is it possible to increase the number of queries running at the same time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-01-03
@kirill_782

If I understand correctly, this is a controller in asp net.
If you are using asp net core then they should run in parallel.
Perhaps you have some kind of synchronization in the calling code that does not allow you to run two queries at once.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question