Click here to Skip to main content
15,883,978 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I have a MVC3 application which uses a local database. I have a connection string in web.config file which specifies the connection.
<add name="RoomDB" 
       connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Room Details;User ID=sa;Password=sa;" 
       providerName="System.Data.SqlClient" />

My application works fine but when I hosted the application in IIS7 in my local system using default app pool, the application can't open the database accessing pages showing the below error.
"Cannot open database "Room Details" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'."

I think something wrong with connection string or in Application pool.
Please provide me help in this regard.

Thanks in advance,
Naresh S.
Posted

1 solution

The recommended Microsoft solution is to create a separate account. However, if your solution is small, you can instead add the 'IIS APPPOOL\DefaultAppPool' user as a database user in your SQL instance, then providing the proper 'User Mappings' to the databases you need the DefaultAppPool user to access.

You may not necessarily be able to search for this user, but you can still enter it in the 'Login name' field in the "Login - New" window as "IIS APPPOOL\DefaultAppPool" (without the quotes).

MSDN Reference at: http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/73eee0b4-9eee-4a71-a448-3e3eef9ee404/[^]
 
Share this answer
 
Comments
S.M.Naresh 13-Feb-12 12:09pm    
Thank you GanesanSenthilvel for providing the solution... created a user login "IIS APPPOOL\DefaultAppPool" and mapped the application database to this user.. this worked fne and I can access the database accessing part from IIS.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900