A network-related or instance-specific error occur

2019-07-28 02:28发布

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)

when i upload my site on webserver and connect with remote sqlserver2005 using connection string....

<connectionStrings>
    <remove name="ConnectionString"/>
    <add name="ConnectionString" connectionString="Data Source=69.16.253.19,1433;Initial Catalog=vb_usa;Persist Security Info=True;User ID=username;Password=password" providerName="System.Data.SqlClient"/>
  </connectionStrings>

it produces the following errr -- you can see error in my webpage :

http://vbi.volvobusesindia.com

it shows an error above ..

i m using aspnetdb.mdf in my website in APP_Data Folder... features i use in my website is Login Control, Password recovery, signup control...

3条回答
孤傲高冷的网名
2楼-- · 2019-07-28 02:34

On that remote machine (63.15.223.19), the SQL services are not running. You can go to that machine and try to run "net start mssqlserver" from command prompt.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-07-28 02:54

Tried all the above but did not work for me. When I checked Services, I found that the SQLExpress service which was set Automatic, was not started. Once I started the SQLExpress service, everything worked.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-07-28 03:01

See the guide in this site http://www.connectionstrings.com/sql-server-2005

In particular look at the section on that page titled "Attach a database file, located in the data directory, on connect to a local SQL Server Express instance"

The format is:

Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;

Basically, you need to connect to the SQL Express instance installed on the web server and point it to where your database file is located.

查看更多
登录 后发表回答