Solved

Not able to connect to SQL Server from IIS

Posted on 2012-03-27
3
268 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
  • 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 500 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now