1

I'm working on a website using ASP.NET, C# and mssql. When I run the website on our local server it is working fine.

The following error occurs when I run it on a shared server:

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)

I don't know how to play with connection string now since I'm very new to this.

Marcel Gwerder
  • 8,353
  • 5
  • 35
  • 60
Prhem
  • 117
  • 1
  • 2
  • 7
  • Are you specifying a connection string in your Web.Config? – Fred Apr 16 '14 at 09:21
  • yes am specifying my connection string in web.config – Prhem Apr 16 '14 at 09:25
  • Take a look at this site http://www.connectionstrings.com/sql-server/ at a guess your server/data source setting is incorrect. some providers will give you an instance to connect to as well as the server. The link above will show you how to connect which ever way it is. It will be difficult for anyone to tell you exactly what is wrong unless you posted your connection string setting as you have it in your web config and the settings provided by your host. – Fred Apr 16 '14 at 09:32

1 Answers1

0

It is recommend to keep the connection string in web.config. To create a valid connection string with SQL Server (either located on network or locally), use following steps:

Steps:

  1. Create a Test.UDL file at your desktop.
  2. Double click the file to see undermentioned Data Link Properties
  3. Select provider i.e SQL Server in your case
  4. Provide connection details i.e. server, username, password etc. in Connection tab.
  5. Test Connection on connection tab and press "OK".
  6. Open UDL file in notepad to see valid connection string.

enter image description here

UPDATE

check following link for creating UDL http://msdn.microsoft.com/en-us/library/e38h511e(v=vs.71).aspx

check following link for connection string Setting up connection string in ASP.NET to SQL SERVER

Community
  • 1
  • 1
Hassan
  • 5,360
  • 2
  • 22
  • 35
  • Thanks for the reply ...Mr.Hassan Nisar is there step by step process. am very new to this.!else any tutorial links!..Thanks in advance – Prhem Apr 16 '14 at 09:28
  • Mr.Hassan Nisar, I have found out the way you said, bur my database in shared remote host. When i call the IP of the server database is not showing even in i give login which i use normally – Prhem Apr 16 '14 at 09:42
  • 1
    Ping IP and tell if it is responding? Also tell how are you specifying **\SQLExpress** etc. or not? – Hassan Apr 16 '14 at 09:46