title: Login failed for user 'IIS APPPOOL\ASP.NET v4.0'
body: <p>I have a web project (C# Asp.Net, EF 4, MS SQL 2008 and IIS 7) and I need to migrate it to IIS 7 locally (at the moment works fine with CASSINI).</p>
  
  <p>Locally in IIS I have my <code>Default Web Site</code> with my deploy. Both my deploy and <code>Default Web Site</code> are on pool ASP.NET v4.0 (look image for settings) the pool target Framework 4 as my web project.
  <img src="https://i.stack.imgur.com/nNY78.png" alt="Pool Settings">
  When visiting the site, the browser does not show the page and allow the browser to download the page instead.</p>
  
  <p>I have other projects running on IIS locally and they work with no problems (but they do not use Entity Framework).</p>
  
  <p>Using the Event Logger I see errors as below:</p>
  
  <pre><code>Exception information: 
      Exception type: EntityException 
      Exception message: The underlying provider failed on Open.
     at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean&amp; closeStoreConnectionOnFailure)
  
  
      Login failed for user 'IIS APPPOOL\ASP.NET v4.0'.
         at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
         at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
         at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
         at System.Data.SqlClient.SqlConnection.Open()
         at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean&amp; closeStoreConnectionOnFailure)
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/7697867/passing-from-cassini-to-iis-7">Related question</a></p>
  
  <p>UPDATE:
  You can read in the resources on this question that permissions must be granted on MS SQL 2008 manually as arift explain in his answer.
  Using IIS 7.5 and MS SQL 2008 R2, setting manually permission should not be necessary.</p>