问题
I HOST MY ASP.NET WEBSITE ON WEBSERVER ..But after upload when i try to access my site ...
http://www.vbi.volvobusesindia.com
Then following error occurs ....
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 have changed my connectionstring in web.config file and all webpages to :
<connectionStrings>
<remove name="ConnectionString"/>
<add name="ConnectionString" connectionString="Data Source=69.16.253.19,1433; Network Library=DBMSSOCN; Initial Catalog=database;Persist Security Info=True;User ID=username;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>
...before publishing and uploading my website to webserver ...
I m confused the problem is from my local computer or the webserver ....and how to fix this error ?
回答1:
This means that your web server can't connect talk to the SQL server. Are you sure that the IP is correct, and that the SQL server is configured to accept remote connections over IP?
Can you connect to the database server using SQL Management Studio, using the same username, password and IP address that are in your connection string? Is your application retrieving the correct connection string from web.config?
回答2:
ASP.NET can't connect to your database - either the address is wrong, or the SQL Server isn't configured to accept remote TCP/IP connections, or (probably more likely) there's a firewall in between that's stopping the traffic from getting through...
回答3:
Not sure but might be this: Data Source=69.16.253.19,1433 . If 1433 is the port you are trying to use, write it with a : .69.16.253.19:1433
回答4:
I saw on you other post before they closed it that may have held the key to your problem. I noticed your server was saying cannot find "C:\Users\Ashis..."
It looks to me like your server is using client side code to get the path to the database. Therefore the browser is always looking on the "clients" machine.
You need to use server side script, something like Server.MapPath("mydbname") (c# syntax) to get path of the database.
来源:https://stackoverflow.com/questions/4737948/a-network-related-or-instance-specific-error-occurred-while-establishing-a-conne