Note that there are some explanatory texts on larger screens.

plurals
  1. POTimeoutException not being thrown Linq to SQL DataContext.CommandTimeout C#
    primarykey
    data
    text
    <p>I'm trying to throw a TimeoutException whenever it takes longer than 4 minutes to execute a stored procedure call in Linq to SQL. </p> <p>Here is the code in my controller:</p> <pre><code>public IEnumerable&lt;Quality&gt; Get(DateTime param1, DateTime param2, string param3) { var dc = new VideoDataContext(WebApplication.MonitorServer); dc.CommandTimeout = 240; List&lt;Quality&gt; cqs = dc.Vid_GetQualityForVideo(param1, param2, param3).ToList(); return cqs; } </code></pre> <p>For some reason the code executes for longer (way longer) than 4 minutes but doesn't throw a timeout exception. In the end I get a Memory exception for really big queries. </p> <p>I can't optimize the query or even see it because I don't have access to the stored procedures. I can only detect a timeout in the application. Does anyone know why I'm not getting a TimeoutException. </p> <p>In other places in my code I have very similar code and the timeout is thrown after 4 minutes on another server holding a different database. It's just not happening here.</p> <p>I can write to the Data team to change something in their but I'd like to be specific as to what the problem is.</p> <p>Thanks!</p> <p>Edit: To clarify I saw before when I retrieved data it would take forever and noticed that it was the massive amount of data being passed to the client. I have an MVC Action Filter that detects the number of rows and if it's more than a certain threshold (10000 right now) it only passes an error message to the client and not the entire dataset. The queries I'm running return way more than the threshold but it's still taking longer than 4 minutes to complete.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload