Multi Threading in API in C# : <p>I'm trying to create an Web Service that runs an asynchronous function with .Net Core Framework.</p>

<p>This function must be executed in its own thread and return a new value that will be sent to the proper caller.
The service must be listening for other calls while my async function is running, and start a new thread for each call.
Once the thread is finished, I want the response to be sent to the original caller.
I have tried this way :</p>

<p>In my controller I have :</p>

<pre><code>[Route("api/orchestration")]
public class OrchController : Controller
{
    [HttpGet("{value}")]
    public void RunOrchestration(int value)
    {
        Program.GetResultAsync(value); // Notice that no value is returned but it respects the asynchronicity and the multithreading as asked
    }
}
</code></pre>

<p>In my main class I have :</p>

<pre><code>public async static Task&lt;string&gt; GetResultAsync(int i)
{
    return await OrchestrationAsync(i);
}

public static Task&lt;string&gt; OrchestrationAsync(int i)
{
    return Task.Run&lt;string&gt;(() =&gt; { return r = Orchestration(i); });
}

public static string Orchestration(Object i)
{
    // This function is an orchestrator of microservices that talk asynchronously through a MOM 
    // Just consider that it returns the value I want in a string
    return result;
}
</code></pre>

<p>As you can see I want my function GetResultAsync to return a string with the value that will be sent to the caller.
Yet I can't have something like this (see code below) because GetResultAsync returns a Task and not a string :</p>

<pre><code>public string RunOrchestration(int value)
{
    return r = Program.GetResultAsync(value);
}
</code></pre>

<p>And if I put an await in RunOrchestration, it will wait for the response and will behave as a synchronous function.</p>

<p>Anyone has an idea on how to get my response and give it back to the proper caller ?</p>

<p>Thank's in advance ! :)</p>
