I have a problem using WCF ChannelFactory in multi threading environment. When I call the a method from the ChannelFactory, I keep geting timeout on my calls.
private static ChannelFactory<Foo> factory = null;
private static object lockObj = new object();
... in my thread method:
Foo obj
lock(lockObj)
{
if(factory == null)
{
factory = new ChannelFactory<Foo>(basicBinding, New EndpointAddress(New Uri(u)));
}
obj = factory.CreateChannel();
}
obj.doSomething();
obj.close()
... When the code execute the obj.doSomething(), I get a timeout exception and I don't understand why. And worst, some times, the call pass witought problems and I ged expected results.
I also noted that there are only 2 call made when the program execute.