I have a server with a SQL2008 Database and IIS7. I created a WCF service, that access the SQL-Server and returns the resultset in form of a List<T>
.
My problem is, that I get timeouts when accessing the service from my client, although the query should not take too long (about 1 sec in SQL-manager) it fetches 17.256 lines.
When I constrain the query to just read a dozen lines, it runs fine:
SqlCommand command = new SqlCommand("SELECT stammDatenId, position, latitude, longitude FROM geoKoordinates ORDER BY stammDatenId, position", connection);
IDataReader reader = command.ExecuteReader();
int count = 0;
while (reader.Read())
{
GeoKoordinates geoKoors = new GeoKoordinates();
geoKoors.stammDatenId = reader.GetInt32(0);
geoKoors.position = reader.GetInt32(1);
geoKoors.latitude = reader.GetDouble(2);
geoKoors.longitude = reader.GetDouble(3);
resultSet.Add(geoKoors);
if (count > 10)
break;
count++;
}
reader.Close();
But as you might guess, I need all the 17k lines. The network connection speed should not be an issue, for the server and my client both are inside our LAN, with 100 MBit lines. When saving the result set to csv from SQL-Manager it is just 600 kb big.
Any idea where the bottleneck might be and how to solve this? I have no idea, what part of the code might be relevant to answer this question. If you need to see some special parts, please note it here and I'll provide it.