I am completely new to WCF. I was pretty sure it was going to work like regular web services - and I'm also pretty sure I was doing that wrong too, but now I want to make sure I'm doing it right.
Our ASP.Net app connects to the WCF service across the internet. I have impletemented basic security and using SSL. It is working, but slower than when we had regular web services going. The data being returned is fundamentally the same as with the regular web service.
When I was using the regular web service, anytime I needed to get data, I would create a new service object and call the function for the data I needed. This seemed to work ok, but as I would imagine, not the best way to do it especially if there were thousands of users connecting at the same time. So when I converted to WCF, I decided to keep one client open and just use that for everyone connecting to the site. I put it in the cache and when the cache would dump the object, I had a callback function to dispose it.
Now I didn't even think about it till after I changed all this that it might pose an issue for multiple people connecting. If person A requests data, person B has to wait for that to finish before their data is fetched through the service.
So I changed it to be session based. I either implemented this wrong or it just backfired as it didn't work well at all. The client would time out, cause a fault, or just plain not work. I changed it back to being cached for now and it seems to be working fine (except slow).
What is a "best practice" for this scenario? Do I create the client on the fly when it's needed, create one session based (and figure out what I did wrong), or keep it as is and use the one client cached method?