當你的資料庫為SQLEXPRESS時,在程式的資料庫連接字元串的服務Server使用127.0.0.1\SQLEXPRESS時,如下:它會顯示一異常: Server Error in '/' Application. A network-related or instance-specific er ...
當你的資料庫為SQLEXPRESS時,在程式的資料庫連接字元串的服務Server使用127.0.0.1\SQLEXPRESS時,如下:
它會顯示一異常:
Server Error in '/' Application.
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)
127.0.0.1只能使用預設實例名。如果你想連接非預設的資料庫的話,即是說帶有實例名的資料庫時,那你得參考:
《The system cannot find the file specified》http://www.cnblogs.com/insus/p/5426975.html