Link to home
Start Free TrialLog in
Avatar of BoxunloX
BoxunloX

asked on

IIS7 Application Pool Cannot Connect to SQL Server 2008 Database

Hello all,
 I have a server running Windows Server 2008, IIS7, and SQL Server 2008, on which I am running an ASP.NET application. For some reason, I am getting an error at the logon screen of the Web app stating the following:

Can't connect to DB:

[Microsoft][SQL Server Native Client 10.0] Named Pipes Provider: Could not open a connection to SQL Server [2].


GET variables:
--------------

POST variables
--------------:

SESSION variables:
------------------
DBType = SQLSERVER
NetClassification = ""
BlahBlahBlah = Application Name
LocalShift = -120

Basically what I have narrowed it down to is that the credentials the IIS app pool is using to try to connect to the database with are wrong. The thing is I cannot figure out where to go to configure the credentials that are being used to connect to the DB.

Does this make sense? Does anyone have any advice?
Avatar of gaurav05
gaurav05
Flag of India image

Hi,

you need to configure connection string in web.config file.

<connectionStrings>
<add name="myConnectionString" connectionString="server=localhost;database=myDb;uid=myUser;password=myPass;" />
</connectionStrings>

also you need to provide sa username & Password. in this connection string.
ASKER CERTIFIED SOLUTION
Avatar of BoxunloX
BoxunloX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BoxunloX
BoxunloX

ASKER

figured out the solution myself.
Hi,
 Create a blank text file and save it with .udl extension i.e abc.udl
A warning that changing file extensions can cause files to become unusable might appear. Disregard it.
Double-click the universal data link (.udl) file.
The Data Link Properties dialog box opens, displaying the following tabs: Provider, Connection, Advanced, and All. Choose Next to navigate from tab to tab.
On the Provider tab, select a database provider.
On the Connection tab, either select the data source name (DSN) of an available Provider, or enter a custom connection string. Valid DSNs for providers that are pre-defined on your system are displayed in the Use Data Source drop-down list.
Use the Advanced tab to view and set other initialization properties for your data.
Use the All tab to review and edit all OLE DB initialization properties available for your OLE DB provider.
Choose OK to save the connection string to the Universal Data Link (.udl) file.

Now Open this udl file with notepad and in last line you will get actual Connection String. You can use this connection string in any application.