Reputation: 1110
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?
Upvotes: 8
Views: 649
Reputation: 1110
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.
Upvotes: 0
Reputation: 303
When you run fiddler it acts as a proxy for all the network calls, right? So probably this proxy responds faster than the real DNS host. What is the connection time out you've set in the binding configuration?
Upvotes: 1
Reputation: 6953
As weismat suggest, it could be DNS issues. If you're using DNS names in your WCF URL, try using loopback ip instead (127.0.0.1) or your local IP.
Upvotes: 0