Click here to Skip to main content
15,888,088 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am running my web application where the connection string is of the Web server and the application is running locally ,then it works fine but after uploading the application on Web server it gives the error
"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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server"

I have checked all the connection string but there is no connection is made on local server
Note:- In the application I have another library project and so I have one web.config and one app.config but the connection string in both of them is same,Still its not working.Any help will be appreciated.
Thanks
Posted
Updated 24-Dec-13 2:20am
v4

The message error is telling exactly what you need to do: Verify that the instance name is correct and that SQL Server is configured to allow remote connections

Troubleshooting SQL Server Connection Problems[^]
Enable TCP/IP Network Protocol for SQL Server[^]
Configure the Windows Firewall to Allow SQL Server Access[^]
 
Share this answer
 
Hi Sumit,

if your database in other server(access remote database) then first of enable remote access of sql server form sql server property from sql server management studio and enable TCP/IP named pipe form sql server configuration manager.

Hope this helps you a bit.

Regards,
RK
 
Share this answer
 
Comments
Sumit Bhargav 24-Dec-13 8:27am    
Thanks for replying,
I have access perfectly to my local server but i am talking about web server.Its not working on web server when application is live while its working on web server when application is running locally.
Just check your web server where your hosted your app,
its seems like your web server is not able to access your database using connection information your provided to your connection string.
Some times, when database is located to different server and your web server is restricted over there to access or your database server and web server both are in different networks. your error message shows that your web server is not able to access your database, so please check your network connection and also check that your database is allowed to browser over network or not.

http://blogs.msdn.com/b/sqlblog/archive/2009/07/17/how-to-configure-sql-server-to-listen-on-different-ports-on-different-ip-addresses.aspx[^]
 
Share this answer
 
Comments
Sumit Bhargav 24-Dec-13 8:38am    
Hi Tejas,
Looks like you are not getting what i am trying to explain.
I am running an application on my PC but the connection string is of the web server then it works perfectly ,it founds the connection and i can do all the CRUD operations but when the
application is uploaded on web server then it dose not make a connection and shows that error.
There is no point of changing any kind of settings coz my other forms are working perfectly.
I hope you understand it well now if not please don't mind to ask.
Tejas Vaishnav 24-Dec-13 8:42am    
I can't understand that "There is no point of changing any kind of settings coz my other forms are working perfectly."
your another page or forms work perfectly means your can able to connected to database and retrieve your data from it?
Sumit Bhargav 24-Dec-13 8:55am    
correct..I can access database in my other forms
It was the issue of dll file.The dll was not updated.Thanks to all of you.
 
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