Wednesday, April 4, 2012

Cannot open database "" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\DefaultAppPool'.

Error:

I have a web project (c# asp.net, EF 4 and MS SQL 2008 & IIS 7)
I need to move my website (that was working with no problem in CASSINI) to IIS 7 locally.
So locally in IIS I have my Default Web Site with my deploy. Both my deploy and Default Web Site are on pool ASP.NET v4.0 (look image for the setting) the pool target framework 4 as my web project. enter image description hereWhen browsing the site, the browser does not show the page and allow the browser to downalod the page instead.
Using the Event Logger I see this errors.
I have other project running on IIS locally and they run no problem (but they do not use EF). It is more that 8 hours I try to fix it but with no success ... any ideas? many thanks guys!
Solutions:

You can change the ApplicationPoolIdentity from IIS7 -> Application Pools -> Advanced Settings.AdvancedSettings
Under ApplicationPoolIdentity you will find local system. This will make your application run under NT AUTHORITY\SYSTEM, which is an existing login for the database by default.

No comments: