0

I am attempting to deploy an asp.net application to a Windows Server 2012 server and have come across an issue where the application will no longer connect to a localdb server on SQL Server 2012. I am able to access the localdb database in Microsoft SQL Server Management Studio, the database explorer will connect, and I copied the connection string from the properties of the connection into the Web.Config file replacing the asterisks with the actual password. Even though the connection is possible I still can't get it to connect.

The connection string in the Web.Config (Replacing the user id and password with actual values) is:

<add name="ApplicationServices" 
     connectionString="Data Source=(localdb)\v11.0;Initial Catalog=Grouplink;Integrated Security=False;User ID=******;Password=*********;" 
     providerName="System.Data.SqlClient" />

The exception details are as follows:

System.Data.SqlClient.SqlException was caught
  Class=14
  ErrorCode=-2146232060
  HResult=-2146232060
  LineNumber=65536
  Message=Login failed for user 'sa'.
  Number=18456
  Procedure=""
  Server=(localdb)\v11.0
  Source=.Net SqlClient Data Provider
  State=1
  StackTrace:
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions)
       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, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions)
       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, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
       at System.Data.SqlClient.SqlConnection.Open()
       at GroupLinkMembership.SQLNet.GetTable(String TableName, String Cmd) in C:\Users\Administrator\Documents\GroupLinkMembership\GroupLinkMembership\SQLNet.vb:line 20
  InnerException: 

The application worked on the development system so I do not know why the code is not working while the other access methods do work. The exception occurs when attempting to open the connection.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Steven Law
  • 31
  • 1
  • 7

1 Answers1

0

Seems like localdb\v11.0 does not exist on the other computer, replace the "(localdb)\v11.0" with applicable "{servername}{SQLServerInstanceName}" in connection string without curly braces in my text.

Gentle
  • 1