PDA

View Full Version : Entity Framework connectivity issue


dweeden
11-26-2009, 12:38 PM
Hello,

I am trying to deploy a web application (using the ADO.NET Entity Framework) and am getting the dreaded "can't connect" error (see bottom of post). I am using the connection string immediately below in my web.config file (with the password replaced of course) and have looked very carefully at the connection string portion of it and it appears valid.

Please advise, the client is awaiting a demo...

Thanks,

Dave

<add name="MyEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=tcp:sql2k802.discountasp.net;Initial Catalog=SQL2008_678671_pm;User ID=SQL2008_678671_pm_user;Password=****;&quot;" providerName="System.Data.EntityClient" />

---------- EXCEPTION DETAILS ------------------


[SqlException (0x80131904): 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.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +4849719
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4863021
System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Data.EntityClient.EntityConnection.OpenStor eConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +47

dmitri
11-26-2009, 12:58 PM
Please make sure you replace **** with your actual password, and remove &quot; parts from your connection string.

dweeden
11-26-2009, 03:38 PM
As I mentioned, I'm not actually using asterisks for my password and with respect to the &quot; tokens in the connection string, they were generated by the Entity Framework Wizard.

I thought it a bizarre thing but a string formatted that way does in fact work fine on my dev machine. The section between the two &qout; escape sequences reads as follows on my machine (and works properly):

Data Source=MyMachine;Initial Catalog=MyDatabase;Integrated Security=True;MultipleActiveResultSets=True

bruce
11-30-2009, 10:55 AM
The error indicating your are trying to connect to an invalid SQL server.

Can you post your complete connection string in the live env?

Please mask out the password.