Login failed for user 'IIS APPPOOL\DefaultAppPool'. with the error code 0x80131904 RRS feed

  • Question

  • Hi Helpers,

    I'm getting the above specified error, while i'm executing my application ( and Sql connection). I followed the steps corresponding to the error code(0x80131904) as per MSDN. Here i observed one thing, I'm getting this error for my current application only, not in any other application.

    Please suggest me the steps to resolve the problem, and could you please explain me why i'm getting this error.


    Thanks in advance.


    Wednesday, May 18, 2011 1:02 PM


All replies

  • Hi,

    Which SQL Server edition are you using? If you are using SQL Express, you must apply the proper permissions on the App_data folder too. ake sure that the IIS Application Pool identity is created as a login in SQL Server and proper permissions assigned.

    If you can post the complete exception, that would help a lot more to check other options.

    I hope it helps.


    There are 10 type of people. Those who understand binary and those who do not.
    Wednesday, May 18, 2011 1:48 PM
  • Hi,

    I'm using SQL 2005 Express Edition only,


    While i'm trying to access values from database(sql) using . while opening the connection it is giving the error --> Login failed for user 'IIS APPPOOL\DefaultAppPool'.And i did not got this kind of error for my previous application.

    please assist me.

    Wednesday, May 18, 2011 2:53 PM
  • If your other ASP.NET applications are working properly with SQL Server then you might want to change the app pool to the same one the other apps are running under. Otherwise, you will need to provide access to the DefaultAppPool user in SQL Server. The below discussion should help:



    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, May 18, 2011 5:10 PM
  • I was developing applications using Visual Studio 2008 on my XP Pro computer. I successfully developed database applications that worked on the VS2008 server. I had a GoDaddy virtual dedicated server. I downloaded Micrsoft SQL Server 2008 R2 Express. The reason for this was that my virtual server was running (x64) and using Server 2008 R2 and IIS 7. I designed a simple program so that I could begin to get my programs to function on the virtual server. Every time I got this error that read "Login failed for user "IIS APPPOOL/DefaultAppPool." I consulted these forums. I read suggestions about adding "IIS AppPool/DefaultAppPool" to the "Logins" section of Server Express and checking "Grant" and "Enabled"  under the "Status" section to give permission to connect to the database. I also checked all of the boxes under the "Server Roles" section. I continued to get the same error. I tried keeping my database in my "App Folder" and also installing it under the virtual server and I still got the same error. After many days I decided to create a completely new database by using SQL Server Management Studio and to replace my test code database reference with this new one. The new database worked perfectly. If you are interested in making the same test jump I made I have recreated the code from my Default.aspx.vb file below. I have a simple ASP project with a button (Button1) and a text box (TextBox1).


    Imports System.Data.SqlClient

    Imports System.Data

    Imports System.Configuration

    Partial Class _Default

    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender as Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim cn As New SqlConnection()

    cn.ConnectionString = "DataSource =(local)\SQLEXPRESS; Intial Catalog = mydatabasename; Integrated Security = True"


    Dim strSQL as String = "Select * From mytablename"

    Dim mycommand As New SqlCommand(strSQL, cn)

    Dim myDataReader as SqlDataReader

    myDataReader = mycommand.Execute Reader(CommandBehavior.CloseConnection)

    While myDataReader.Read

         Dim mystring as String

         mystring = MyDataReader("FirstColumnNameInDatabase").ToString().Trim()

         TextBox1.Text = TextBox1.Text & mystring

    End While


    End Sub

    End Class

    I have seen a wide divergence of answers that seem to help people but I think it is because there are so many variables.



    Sunday, December 30, 2012 3:59 AM