Description
dotnet 1.0.0-rc2-3002702
Microsoft.EntityFrameworkCore.SqlServer 1.0.0-rc2-final
Ubuntu 14.04 LTS
Microsoft SQL Server 2008 R2 (SP1)
10.50.2550.0 (X64) Jun 11 2012 16:41:53 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)
Connection string:
Data Source=192.168.1.x;Initial Catalog=DBName;Persist Security Info=False;User ID=username;Password=pass
This issue may be related to #16528.
Unfortunately, we cannot upgrade our SQL server service pack. The same application works fine on Windows. This also impacts Entity Framework .
Code:
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
Console.WriteLine(String.Format("{0}, {1}",
reader["Id"], reader["Email"]));
}
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
Full error:
Executing action method Dashboard.Controllers.HomeController.Index (Dashboard) with arguments () - ModelState is Valid'
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware
An unhandled exception has occurred while executing the request
System.Data.SqlClient.SqlException: Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=159; handshake=578; [Login] initialization=9; authentication=40; [Post-Login] complete=14062; ---> System.ComponentModel.Win32Exception: Unknown error 258
--- End of inner exception stack trace ---
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Dashboard.Controllers.HomeController.Index()
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.FilterActionInvoker.d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.FilterActionInvoker.d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware
1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware
1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware
1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware
1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ApplicationInsights.AspNetCore.ExceptionTrackingMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__7.MoveNext()
ClientConnectionId:1f658ddc-13f8-43e8-85a3-fdd8cc853eff
Error Number:-2,State:0,Class:11
Activity
txdv commentedon Jun 28, 2016
I think you might want to put the error output in a code block as well
thepaleone commentedon Jun 28, 2016
I'm receiving the same error as the OP. My versions are the same. The only differences are I used an older connection string syntax, but same results. That probably has no value, but just in case I thought I'd add it. It works when running on a Windows machine, but not when running on Linux, specifically CentOS 71.
"server=SERVERNAME;database=DBNAME;User=USERNAME;password=PASSWORD;"
akalisingh commentedon Jul 1, 2016
I have tested the same application with SQL server 2014 Express on Linux, works great!
Gorillagaragedigital commentedon Jul 6, 2016
Hi , perhaps have you solved ? Also I am in the same situation (SQL 2005)
saurabh500 commentedon Jul 11, 2016
@ranjit-s Is it possible to update your 2008 server to SP3 from the location https://www.microsoft.com/en-us/download/details.aspx?id=27594 ?
akalisingh commentedon Jul 12, 2016
@saurabh500, our IMS only supports SP1 (2008 R2) so upgrading is not an option.
mikes-gh commentedon Jul 18, 2016
@ranjit-s Sorry I think that's your only option. I had the same error ans 2008 r2 sp3 fixed it for me.
thepaleone commentedon Jul 18, 2016
Upgrading the server to 2008 R2 SP3 resolved my issue, thanks!
saurabh500 commentedon Jul 19, 2016
@ranjit-s We won't be working on supporting SP1 connectivity from Linux right now. The current supported version for 2008 R2 is with SP3 service pack
https://support.microsoft.com/en-us/lifecycle?C2=1044
bfdill commentedon Aug 16, 2016
I see this is closed, so I hesitate to ask, but I've got a client with SQL 2008 SP3 (not R2). I just don't see them upgrading. I was excited to get into dotnet core and shocked to run into this issue mid-development. Is there any plan to go back before SQL 2k8 R2?
ghost commentedon Feb 3, 2017
@bfdill For what it's worth, I was also running SQL Server 2008 SP3 and had connectivity issues. I upgraded to SP4 and I was able to connect just fine.
JustoDaniel commentedon Jan 10, 2018
We were having the same problem here in the company, it was resolved after we made upgrade to SP4
jadaf59 commentedon Apr 17, 2020
Same issue. Resolved by upgrading from SP1 to SP3
NorDroN commentedon May 19, 2020
Is it possible to run dotnet core with ef core in docker and connect to Microsoft SQL Server 2008 R2 (SP1)?
Unfortunately, we cannot upgrade our SQL server service pack too.
cuesto commentedon Jun 23, 2020
I'm on the same situation. If I run my .net Core app it works, but once dockerize the app it shows this error