我首先使用EF代码生成我的数据库,它已经有效了。当我尝试通过以下方式从表中读取数据时:
var l = db.MyTable.ToList();
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)
我收到了这个错误。我通常因为错误的连接字符串。但我的连接字符串是正确的。我用它来更新我的数据库,任何改变都是正确的。