1

我已经像这样设置了我的 web.config:

<add name="DefaultConnection" connectionString="Data Source='C:\Users\Marilou\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0\authentication.mdf';Initial Catalog=javacert;Persist Security Info=True;User ID=sa;Password=yyy" providerName="System.Data.SqlClient" />

但我收到消息:

   Message=The provider did not return a ProviderManifestToken string.
   Source=EntityFramework
   StackTrace:
        at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
        at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
   InnerException: System.Data.SqlClient.SqlException
        HResult=-2146232060
        Message=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: 26 - Error Locating Server/Instance Specified)
        Source=.Net SqlClient Data Provider
        ErrorCode=-2146232060
4

1 回答 1

0

好像您正在使用 LocalDB。从这篇 MSDN 文章(http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx),连接字符串如下:

Data Source=(localdb)\v11.0;Integrated Security=true;AttachDbFileName=C:\MyData\Database1.mdf".
于 2013-10-03T17:10:41.467 回答