Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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]
GO
CREATE USER [NT AUTHORITY\NETWORK SERVICE] FOR LOGIN [NT AUTHORITY\NETWORK SERVICE]
GO
USE [AdventureWorks]
GO
EXEC sp_addrolemember N'db_datawriter', N'NT AUTHORITY\NETWORK SERVICE'
GO
USE [AdventureWorks]
GO
EXEC sp_addrolemember N'db_datareader', N'NT AUTHORITY\NETWORK SERVICE'
GO

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: http://vyaskn.tripod.com/sql_server_security_best_practices.htm

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

 
discard

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.