0

I'm using LINQ to SQL to access a stored procedure. This works fine on my local sql server. But once I point to a different server within the internal network, I get a timeout. In SQL Profiler, I can see the query that is sent to the problem server. This should mean the query is hitting the server and executing right?

I can run the LINQ output directly on the problem server without issue. Is this probably not a code issue and instead some problem with the sql server server configuration? What should I check to troubleshoot it?

4thSpace
  • 43,672
  • 97
  • 296
  • 475
  • The sproc will return 20k rows when unrestricted. It takes just over 30 seconds to execute manually. I have my connection string ('Connect Timeout') set to 500. – 4thSpace Oct 04 '12 at 16:47

1 Answers1

2

The connect timeout is different from the command timeout.

see: What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout?

The summary is connect timeout is the amount of time to establish a connection.

Command timeout is the amount of time to let the command run. Not just how long it takes to get the first record, but how long it takes to grab the entire dataset.

If you see the query showing up in SQL Profiler, then yes it is being sent. So you're essentially hitting the command timeout default limit of 30 seconds.

I would suggest starting with changing the command timeout to 500 and see where that takes you. Then I would start doing some performance analysis to determine why it takes that long. Maybe you can trim out some of the data requested or even add additional indexes to better support the query.

Community
  • 1
  • 1
NotMe
  • 87,343
  • 27
  • 171
  • 245