6
votes

I am getting the following error when trying to run a web application on Windows Server 2008 R2. Getting this error when the application is trying to connect to the database. However, I am able to run the application without any issues on another web server(Windows Server 2008 R2).

I see that there were a lot of posts on this error, but I couldn't get a solution out of it for me.

Any help would be appreciated.

Error:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)]

System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +89
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +207
   System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) +502
   System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) +153
   System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket() +90
   System.Data.SqlClient.TdsParserStateObject.ReadBuffer() +39
   System.Data.SqlClient.TdsParserStateObject.ReadByte() +21
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +108
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +36
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +234
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +367
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +234
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +217
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +492
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +29
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +437
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +70
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +449
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +103
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +116
   System.Data.SqlClient.SqlConnection.Open() +478
   Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) +123
   Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText) +11
   Providence.Internet.MyAccount.Utilities.ServiceAreaUtilities.GetServiceAreasFromDataBase() +168
   Providence.Internet.MyAccount.Utilities.ServiceAreaUtilities.GetServiceAreas() +100
   LabTestCatalog.Global.Application_Start(Object sender, EventArgs e) +45

[HttpException (0x80004005): A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +407
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +130
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +296
   System.Web.HttpApplicationFactory.GetPipelineApplicationInstance(IntPtr appContext, HttpContext context) +54
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +237

[HttpException (0x80004005): A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +639
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +78
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +334
1
Does your connection string contain Connection Timeout=XX; ? If not try adding that, and if it does, try increasing the value of XX to say 60Hannah Vernon
Does that error always happen? Under what circumstances does it happen? How stable is the network?usr
What does the SQL Server error log show at the time this error happened?usr
Did you find any solution for this?Niall Connaughton

1 Answers

-2
votes

This is a Windows error message usually given when there are problems with the network or network adapter. The following Microsoft KB article has more information:

http://support.microsoft.com/kb/325487