2009-09-19 6 views

Répondre

1

Le thread a déjà été alloué à partir du pool de threads afin qu'il ne puisse pas devenir un thread créé dans un STA. Ce que vous pouvez faire est de lancer un thread STA à partir de votre méthode IJob.Execute.

public void Execute(JobExecutionContext context) 
{ 
    Thread t= new Thread(DoSomeWork); 
    t.SetApartmentState(ApartmentState.STA); 
    t.Start(); 
    t.Join(); 
} 
Questions connexes