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

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

Question

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"
    providerName="System.Data.SqlClient"
    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"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

I'm running SQL Server 2008 Express.

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

1
1
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.

1
6/5/2012 12:32:00 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

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