Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7401811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:34:24+00:00 2026-05-29T04:34:24+00:00

Before reading please note that I’ve googled this and read a ton of articles

  • 0

Before reading please note that I’ve googled this and read a ton of articles on SO and elsewhere, no suggestions have worked as of yet.

I’m randomly getting a timeout error that occurs when logging into my MVC 3 application. It happens well over half of the time – all other times the application logs on just fine. When it doesn’t work, it tries for about 10 seconds then errors.

The error:

Exception: “An error occurred while executing the command definition. See the inner exception for details.”
Inner Exception: {“Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.\r\nTimeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.”}

This happens inside my repository class that directly interacts with entity framework.


It seems to happen when logging in and simply pulling a quick check from the database, such as:

 return entities.Users.SingleOrDefault(user => user.UserName == userName);

 return (entities.Users.SingleOrDefault(u => u.UserId == user.UserId || u.UserName == user.UserName) != null);

Things I’ve tried:

  • SQL Server validation
  • Integrated Security (I even gave every possible account full database access)
  • Running outside of IIS
  • Setting Connect Timeout extremely high (Connect Timeout=50000) in the connection string. (I do not have Default Command Timeout set here)
  • Setting the CommandTimeout to 0, 5000, 100000, whatever, on my entity connection: entities.CommandTieout = 100000;
  • Setting the CommandTimeout inside every using statement where I use an instance of the repository.
  • Flipping SingleOrDefault to FirstOrDefault etc.
  • Enabling/Disabling Lazy Loading (Why not?)

If it helps:

  • I am using a custom role and membership provider.
  • I’m just making calls from my controller inside a using statement (AccountRepository bleh = new AccountRepository()) and the AccountRepository implements IDisposable etc.
  • The entity model is in a separate project.
  • I’m running the site in IIS. It’s setup with the 4.0 integrated app pool.
  • All accounts have full database access.
  • When the error occurs, it doesn’t take no where near as long as I have set in the web config (50000 I think) or for the commandtimeout in the repository.
  • It’s not doing much on the login, just validating user, getting user role then loading up some small amount data, but the error always occurs when getting the user data on login.
  • When I try it outside of debugging it repeats the error four or five times (with custom errors off).

Here is the full exception from the event log:

Exception information: 
Exception type: SqlException 
Exception message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:34:26+00:00Added an answer on May 29, 2026 at 4:34 am

    You could examine the problem from the database server by setting up a SQL Server Profiler.

    You can find lots of info about SQL Profiler by just googling around. Here’s a site with a video that might help you get started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: Before reading this question and its answer, please check your input element has
Before reading, please note that I am very new to both PHP and MYSQL.
Before you continue reading, trust me when I say I have read all the
Check this example before reading the question - http://www.sqlfiddle.com/#!2/fcf3e/8 The following data comes from
My problem involves checking if I have a valid database connection before reading from
Reading about Kohana templates and saw something I've never seen before: $this->template->title = __('Welcome
Before you answer this I have never developed anything popular enough to attain high
!!! WARNING !!! Dearest SQL expert, please keep reading before to start to scream.
I have done this successfully many times before, but this time it just won't
Hello I understand from reading advice on this site that scripts should go at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.