Solved

IIS7 Application Pool Cannot Connect to SQL Server 2008 Database

Posted on 2011-09-15
4
750 Views
Last Modified: 2012-05-12
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?
0
Comment
Question by:BoxunloX
[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
4 Comments
 
LVL 10

Expert Comment

by:gaurav05
ID: 36542006
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.
0
 
LVL 1

Accepted Solution

by:
BoxunloX earned 0 total points
ID: 36542111
The connection string is already there. I actually just figured out the issue. I had to configure the app pool to authenticate with a local admin account in IIS7 and I also did this in SQL Server 2008 in the security properties of the database that I was trying to connect to. Once I did this everything worked fine.
0
 
LVL 1

Author Closing Comment

by:BoxunloX
ID: 36565403
figured out the solution myself.
0
 
LVL 1

Expert Comment

by:NajamG
ID: 36542704
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.




 
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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