0

I want to connect database in server but this error occurs.

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: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

The connection string is:

connectionString="Data Source=localhost; initial catalog=databasename; user ID=id; password=pwd;" providerName="System.Data.SqlClient"/>
Community
  • 1
  • 1
  • try opening SQL Server Management Studio and try connecting to localhost with the same id and pwd and see it if works – Sushil Aug 31 '15 at 16:27
  • Are you sure you are trying to connect to a *default* instance? If it is a *named instance*, it should be `localhost\instance_name`. – Thomas Stringer Aug 31 '15 at 16:29

1 Answers1

0

The error show that sql server is down.

Check with sql managment what is the correct instance name

You can try using the windows login: Data Source=localhost;Initial Catalog=databasename;Integrated Security=SSPI;

  • when ı try windows login error change like that > Startup Error: Unable to connect to the Database. Exception Message: Cannot open database "dutluksa_dutluk" requested by the login. The login failed. – user3666390 Aug 31 '15 at 17:12
  • Can you check if your sql server intance is running? – Flávio Rodrigues Aug 31 '15 at 19:16