views:

770

answers:

3

Here is the scenario:

IIS 6 and SQL Server 2005 on same machine:

I have just created a new application inside of my main website in IIS.

The root website has its own database. The application I just created under the root site has its own database, as well.

ASP.net pages in the root site connect to their database using trusted security. This web site is running in the default app pool which uses Windows' Network Service account.

The new application I just created is using that same app pool.

I added the network service account to the new application's database's users and granted db_owner, just like the root site's db is set up. When I try to run my new application I get this error:

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

When I switch the new app's connection string to use the sql server sa account, it works. I do not want to use the SA account.

I cannot figure this out! Please help.

A: 

Sounds like the database is expecting SQL Authentication instead of Windows Authentication.

Eppz
The database itself or the database server. The database server is configured as mixed.The main database is using Windows authentication, so how can I get this new database to do the same?
Ronnie Overby
A: 

In that case you have to add the login as a user to the database you want to use and give the appropriate permissions

SQLMenace
You have misunderstood. In my original post I state: "When I switch the new app's connection string to use the sql server sa account, it works. I do not want to use the SA account."I am trying to use the Windows Network service account (which is working for another database on the same server!)
Ronnie Overby
You need to add that user to the other database
SQLMenace
Again, I stated just that in my question: "I added the network service account to the new application's database's users and granted db_owner, just like the root site's db is set up."Did you read my question?
Ronnie Overby
+3  A: 

By default IIS will try to use an ASPNET account which needs to be granted access to SQL Server. I don't have a setup anymore to describe this but the following link offers a couple of solutions:

bytes.com/groups/net-asp/290050-setting-up-integrated-security-sql-server

Cookey
This is the answer. I had to use the user that is specified under the directory security tab in IIS. I was trying to use the app pool user and that was the problem. Thank you!
Ronnie Overby