Click here to Skip to main content
16,008,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a asp.net website on my local machine it is running fine with connection string

XML
<connectionStrings>
  <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>


on production server(shared hosting) i had to create my database( with a user name and a password) on server by running query it was created successfully with all the tables like on development machine, and i got error(on my login.aspx page) when tried to log in using login page then i used this connection string

XML
<connectionStrings>
  <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;database=Database1;Connection Timeout=30;User id=databaseuserid;Password=databaseuserpassword"
   providerName="System.Data.SqlClient" />
 </connectionStrings>


but i got same error(on login.aspx page) which i got earlier when i tried to log in to my website using its login.aspx page, error is given below

"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)"

Plz can anyone tell me what CONNECTION STRING i should use so that i can run my website without this error.

Thanks
Posted

0) Your web server is on the same box as your database server? In a production environment? Your sysadmin should be shot.

1) You're running a production database with SQLExpress? Your manager should be shot.

2) Sql server connection string samples [^]
 
Share this answer
 
Comments
Member 8145305 8-Aug-11 13:09pm    
Its just a small test application, and that link u have posted i have already tried connection strings which are given there it didn't helped.
I don't think a hosting server will use SQL EXPRESS, you can try below connectionstrings

"Server=localhost;Database=yourDB;User ID=yourID;Password=yourPass;"
 
Share this answer
 
v2
There may be many reasons, read this

SQL SERVER connection problem[^]
 
Share this answer
 
Just enable networking protocols on the production server.this could be the reason for the error code 26.
 
Share this answer
 

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