• 连接SQLSERVER数据库报: The server was not found or was not accessible错误
  • 发布于 2个月前
  • 88 热度
    1 评论
  • AUX
  • 7 粉丝 36 篇博客
  •   

我在调试某个应用程序时,系统报如下错误:

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)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: 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 Error:
Line 13:            {
Line 14:                var query = from n in dataContext.MyArticles orderby n.ID descending  select n; Line 15:                return query.Take(count).ToList(); Line 16:            }
Line 17:        }

这个是什么问题,要怎么解决?


用户评论
  • 风清扬
  • 检查一下你的webconfig里的数据库连接字符串是否正确,这个一般都是数据库连接字符串写错了才会报这种错误
  • 2018/9/15 16:17:00 [ 0 ] [ 0 ] 回复