I have a Windows application that is connecting to a WCF Data Service hosted on the same machine.
The first thing that occurs when the application starts is a query that returns 0 to 3 results. Here's the code:
var environments = ctx.Environments
.AddQueryOption("$filter", "Environment eq '" + ConfigurationManager.AppSettings["environment"] + "'")
.AddQueryOption("$expand", "Departments, SecurityGroups");
The very next thing I do is check if (environments.Count() == 0) which takes about 10 seconds to evaluate. It seems to be slowest the first time, but always takes more than 6 seconds. However, if I'm running Fiddler, I always get the results back immediately.
Why does running Fiddler make it faster?
I appreciate all of the answers, but in the end it appears something was wrong with my VS 2010 develoment environment. I was able to deal with the slow first response by keeping Fiddler up and running, but after installing the Telerik suite of controls, my apps were taking nearly a minute to load a form while debugging. Suspecting this was related to the other issue, I installed VS 2012 and upgraded my projects and now everything works as expected.
Thanks again for your responses.