Solved

IIS7 Application Pool Cannot Connect to SQL Server 2008 Database

Posted on 2011-09-15
4
742 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

15 Experts available now in Live!

Get 1:1 Help Now