Wednesday, March 7, 2012

Connecting to a Named Instance of SQL Server from ASP.Net

Hi,
I have a named instance of SQL Server 2000 called VTMS on a server called
VTMS which resides on a cluster.
I am trying to connect to a database on VTMS from a webapp (URL
http://reports) hosted on a server called RPT (ASP.Net 2.0) using Windows
Authentication.
When I publish this site locally and access it through http://localhost or
publish it on RPT and remote in to RPT and access it through http://reports,
it is able to connect to the database on VTMS. However, if I try to access it
through http://reports from my local machine, it comes up with the error:
An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)
I have the same problem trying to connect to a Reporting Services 2005
report deployed to RPT, but accessing data on VTMS.
My connection strings are as follows:
Data Source:
Data Source=VTMS\VTMS;Initial Catalog=Timesheets
Web.Config:
<add name="HomeDepotON" connectionString="Data Source=VTMS\VTMS;Initial
Catalog=Timesheets;Integrated Security=True"
providerName="System.Data.SqlClient" />
Please help.
You need to enable TCP/IP on MS SQL side.
Right click on SQL server in SQL Server enterprise manager. Tab "General".
Button "Network Configuration"
Make sure you have TCP/IP in enabled protocols.
Also make sure that if there is any firewall between Web server and SQL then
it's open. Also try to ping the SQL server from Web server. Sometimes web
server can not resolve the name of the SQL server due to the network
configuration. Fix it or use IP address.

No comments:

Post a Comment