Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an IIS 7 server(2008 ) and ms sql server 2005 on the same machine. I want my application pool that was created to be able to access ms sql server 2005.

How can I do this

  1. Set your app pool to a account (I think it is done - in the application pool I have created a new pool).
  2. Give that account, access to you SQL Server & database
share|improve this question
up vote 0 down vote accepted

Yes this should work, depending on your requirements, you could use the "NetworkService" account; but this may not be best practice in your environment.

Here is the TSQL to implement (Replace AdventureWorks with your Database name)

USE [AdventureWorks]
USE [AdventureWorks]
EXEC sp_addrolemember N'db_datawriter', N'NT AUTHORITY\NETWORK SERVICE'
USE [AdventureWorks]
EXEC sp_addrolemember N'db_datareader', N'NT AUTHORITY\NETWORK SERVICE'

Note this will give the account read and write permission; but no permission to execute sprocs , I would recommend creating a Database role and granting the execute right to all sprocs then assigning the database user to the role.

More info:

share|improve this answer
Ok thats good it should work but how do I do step 2? – chobo2 Jul 20 '10 at 23:47
fixed post to address your comment. Itis imperative that you understand the basics of Sql Server Security before picking an approach that best meets your requirements. – Jason Horner Jul 21 '10 at 5:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.