0

Every time I have a fresh install of Windows, Visual Studio and Sql Server I always have problems getting an application to connect to the local instance of Sql Server.

I am trying to start an application using Entity Framework code first. Here is my connection string.

<add name="KCSoccerDataContext" 
     connectionString="Data Source=.\MSSQLSERVER;Initial Catalog=KCSoccer;Integrated Security=SSPI" 
     providerName="System.Data.SqlClient" />

I am able to connect to the database instance using Sql Server Management Studio, but can't seem to connect using this connection string. I am assuming the problem has to do with how the database instance is configured.

The error I'm getting is

{"The provider did not return a ProviderManifestToken string."}

I'm not exactly sure what this means or where to go from here.

Any help anyone could give on this would be awesome.

Thanks

StuartLC
  • 104,537
  • 17
  • 209
  • 285
jdavis
  • 8,255
  • 14
  • 54
  • 62
  • Have you looked through [here](http://stackoverflow.com/questions/4741499/how-to-configure-providermanifesttoken-for-ef-code-first) ? – StuartLC Sep 26 '12 at 04:57
  • Similar error message was caused by a login error. Check inner exception to get more information about the cause of the error. Similar question is here http://stackoverflow.com/questions/5423278/ef-4-1-exception-the-provider-did-not-return-a-providermanifesttoken-string – Amr Sep 26 '12 at 05:01
  • Yes, I always try to do some looking around before I ask a question. None of the suggestions on that thread are getting me anywhere. Again, I think it has something to do with my sql server instance being somehow misconfigured. – jdavis Sep 26 '12 at 05:01
  • My inner exception is this: {"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: SQL Network Interfaces, error: 25 - Connection string is not valid)"} --- So I guess I need help figuring out my connection string – jdavis Sep 26 '12 at 05:05

2 Answers2

3

Use just this connection string:

<add name="KCSoccerDataContext" 
     connectionString="Data Source=.;Initial Catalog=KCSoccer;Integrated Security=SSPI" 
     providerName="System.Data.SqlClient" />

MSSQLSERVER is name of default instance. It is not used in connection strings. It even doesn't work from Management studio if you try using it. Only names of custom instances must by used.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
0

You probably didn't enable remote connections for SQL Server since it's a fresh installation. Follow first solution here or here.

Amr
  • 1,935
  • 2
  • 19
  • 29