The underlying provider failed to open , login failed for user IIS APPPOOL

ef-code-first entity-framework sql-server-2008


Since I'm Not a Sql Server Guy, I Want to Connect to the Database Through EF Code First I'm Working On A Client's Application.

The error message I'm getting is

The underlying provider failed to open

Exception information

Cannot open database [DatabaseName] requested by the login. the login failed

login failed for user 'IIS APPPOOL\ASP.NET v4.0"

My web settings

<add name="TraininGoDB"
    connectionString="Server=LOCALPCNAME\SQLEXPRESS;Database=[DATABASENAME];Integrated Security=True;"/>

The following app configuration defines the EF context and entities in a separate project:

<?xml version="1.0" encoding="utf-8"?>
    <!-- For more information on Entity Framework configuration, visit -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
        <parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" />

I'm running SQL Server 2008 Express.

don't know the issue from the web configuration or the database configuration

6/5/2012 12:19:49 PM

Accepted Answer

Your web application's linked web application pool is executing as a user who does not have authorization to access your database. It needs rights, or you may run it as another user who has permissions. So, to sum up: Verify the user that is executing your application pool, and then confirm that person has access to your database.

6/5/2012 12:32:00 PM

Popular Answer


Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow