Thanks for the locking idea. It came to me a few minutes before i read your post, and now i know that this is the best solution.
About executing some code in Main thread you misunderstand me.
I mean in WCF WebService. If WebService even has a main thread?
I am running my own logic for polling.
And i run into another problem.
My code is:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyWSTest : IMyWSTest
{
private static Dictionary<string, TProgressItem> fProgresses = null;
public MyWSTest()
{
if (fProgresses == null)
fProgresses = new Dictionary<string, TProgressItem>();
}
//.....
I hope that variable fProgresses will be there for me forever, but that's not the case. On the next call to WebService, fProgresses is null. I understand that i jump every call to WebService to the constructor, but how can i keep alive my variable fProgresses for as long as the ASP.NET Development Server runs?
I think, that when i choose another hosting environment, this will not be the problem. Or my thinking is incorrect? But how to achieve this in development time?