Running a STA (Single-Threaded Apartment) thread from a Web API (2.1) controller
问题 I'm trying to run a STA (Single-Threaded Apartment) thread from a Web API (2.1) controller. To do this, I'm using StaTaskScheduler: /// <summary>Provides a scheduler that uses STA threads.</summary> public sealed class StaTaskScheduler : TaskScheduler, IDisposable { /// <summary>Stores the queued tasks to be executed by our pool of STA threads.</summary> private BlockingCollection<Task> _tasks; /// <summary>The STA threads used by the scheduler.</summary> private readonly List<Thread>