Solved

IIS7 Application Pool Cannot Connect to SQL Server 2008 Database

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GRANT, REVOKE, DENY 4 36
replication - alerts? 4 30
AWE-based memory on 32-bit servers 1 23
SQL Server CASE .. WHEN .. IN statement - Syntax issue 4 50
I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

20 Experts available now in Live!

Get 1:1 Help Now