Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.. I uploaded my site in website panel
but when I want to login in my site , an error has occured.
this is error :

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)

my connection string is :
HTML
<add name="MyConnectionString" connectionstring="Data Source=localhost;Initial Catalog=NameOfDatabase.mdf;Persist Security Info=True;User ID=UserName;Password=mypass" />



(my service provider says the above format.)
database that I used in my computer(before upload site) is ASPNETDB.mdf(automatically created when I used Asp.net configuration page)(sql express 2008)
I backup from ASPNETDB.mdf and in website panel I create a database with different name and then restore backup to it
(version of sql server in website panel was sql server 2012 )
and it seccessfully restored in my database.

I confused. can anyone help me ?
Posted
Updated 31-Oct-14 1:57am
v2
Comments
Praveen_P 31-Oct-14 7:46am    
post your connection string
hamid025 31-Oct-14 7:55am    
<add name="MyConnectionString" connectionstring="Data Source=localhost;Initial Catalog=NameOfDatabase.mdf;Persist Security Info=True;User ID=UserName;Password=mypass">

The error message says exactly what is wrong!
error:
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.


Please, read this:
Configure the remote access Server Configuration Option[^]
Configure the Windows Firewall to Allow SQL Server Access[^]

Connection string is wrong! It looks like you're trying to attach database, but you wrote, it was successfuly attached.
http://www.connectionstrings.com/sql-server/[^]
 
Share this answer
 
v2
Data Source or Server Name or IP address is Correct. For example here localhost. You can also put a .(dot) instead of machine name. For
example .\SQLExpress

2. If any instance used check whether the instance name is correct. For example here SQLExpress

3. If any remote connections check if there is some firewall installed if yes disable it.

4. Also check if remote connections are configured in SQL Server. To configure SQL Server to allow remote connections read here. This article
also explains how to create an exception in firewall in order to allow remote connections.

also check ..
A-network-related-or-instance-specific-error-occurred-while-establishing-a-conne[^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900