Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Migrator issue(?) with SQL connection string #2235


User avatar
0
joshboilered created

Tried to run the migrator against;

"Default": "Server(localdb)\mssqllocaldb;Database=ProjectName;Trusted_Connection=True;MultipleActiveResultSets=true"

But received the following error. I don't have SQL so I spun up a quick db in Azure, changed my connection string and re-ran the migrator, same issue.

Any suggestions? Thanks.

Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, 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) ... more sql errors then; Run(Boolean skipConnVerification) in C:\Users\joshr\Documents\Visual Studio 2015\Projects\ProjectName\src\ProjectName.Migrator\MultiTenantMigrateExecuter.cs:line 60

ClientConnectionId:00000000-0000-0000-0000-000000000000


2 Answer(s)
  • User Avatar
    0
    daws created

    <cite>joshBoilered: </cite> "Default": "Server(localdb)\mssqllocaldb;Database=ProjectName;Trusted_Connection=True;MultipleActiveResultSets=true"

    But received the following error. I don't have SQL so I spun up a quick db in Azure, changed my connection string and re-ran the migrator, same issue.

    your connection string is incorrect. it's for self hosted mssql database. chose one of those :

    • use the correct local connection string
    • install an sql server express (FREE but size limitation)
    • instan an sql server full (FREE for development only)
    • put the correct connection string from azure
  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @daws. I faced a similar problem with azure some time ago and as far as I remember azure puts some extra parameters to connection strings that it gaves and those parameters might cause connection problems.

    You can try to remove "MultipleActiveResultSets=true" first and give it a try. You can also try your connection string with SQL Server Management Studio or a similar tool that you can test the connection string.