Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Not able to connect to SQL Server from IIS

Posted on 2012-03-27
3
Medium Priority
?
276 Views
Last Modified: 2013-01-14
I am not able to connect to the SQL Server from IIS once I publish my web site. I can connect from Visual Studio to the same SQL Server. But the published version of the application on IIS is throwing the following 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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 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)

Source Error:


Line 514:
Line 515:                // Call the overload that takes a connection in place of the connection string
Line 516:                return ExecuteDataset(connection, commandType, commandText, commandParameters);
Line 517:            }
Line 518:        }
0
Comment
Question by:bcisystems
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37771323
This mostly happens when either the SQL Server is not reachable from Web Server.
Or you might have mis-spelled the instance name in connection string....

Just verify the config file and see the connection string....
0
 

Author Comment

by:bcisystems
ID: 37771434
I have verified the connection string. Its the same as I have in development. It works within Visual Studio. Is there anything that I need to change for production deployment when we publish?
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 2000 total points
ID: 37771457
install SSMS on Web Server and try to connect to sql server from there.
If the same error persists, this means there is some network issue....
0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question