A network-related or instance-specific error occurred while establishing a connection to SQL Server

爱⌒轻易说出口 提交于 2020-02-05 04:42:47

问题


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...


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/4736084/a-network-related-or-instance-specific-error-occurred-while-establishing-a-conne

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!