我想知道我的连接字符串是否错误,因为当我在服务器上发布它时它不起作用,否则当我在调试模式下测试它时它起作用。
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-app-20130122205025;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-app-20130122205025.mdf"
providerName="System.Data.SqlClient" />
<add name="SiteSourceContext" connectionString="Data Source=(localdb)\v11.0; Initial Catalog=SiteSourceContext-20130125171153; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|SiteSourceContext-20130125171153.mdf"
providerName="System.Data.SqlClient" />
有人可以帮忙吗?我相对较新并且正在努力学习,所以我不知道我在做什么,但这是我得到的错误:
[Win32Exception (0x80004005): The specified file is not found]
[SqlException (0x80131904): A network-related error or instance-specific 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: 52 - Could not locate installation of a runtime database locally. Verify that SQL Server Express is installed and the runtime functionality of local database is enabled.) ]
System.Data.SqlClient.SqlInternalConnection.OnError (SqlException exception, Boolean breakConnection, Action `1 wrapCloseInAction) 6675286
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning (TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) 688