Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server-2008 C#4.0 IIS7.5 , +
I am working on web application. Suddenly i got the error "System.Data.SqlClient.SqlException was unhandled by user code: Login failed for user 'IIS APPPOOL\DefaultAppPool". Can anybody help.
Posted 7-Mar-13 20:42pm
Comments
Maciej Los at 8-Mar-13 17:22pm
   
Check that sql services were started...
anjankant at 8-Mar-13 23:39pm
   
Yes, SQL Server services already working.
Maciej Los at 9-Mar-13 12:44pm
   
See my tip: http://www.codeproject.com/Tips/543989/How-to-enum-SQL-Server-instances-in-network. Run exe and check the named instances of MS SQL Server.
anjankant at 14-Mar-13 4:56am
   
Hello Maciej, Thank you for thee reply it couldn't resolve my problem.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

go to iis -> application pools -> find your application pool used in application -> click it and then click 'Advance Settings' in Actions panel. Find 'Identity' property and change it to localsystem.
Please mark as solution if it solve your problem.
  Permalink  
Comments
U@007 at 26-Apr-13 8:56am
   
it's correct 5+ :).
pratapyadav at 23-Nov-13 6:03am
   
thanks
roni.net at 21-Jul-14 16:21pm
   
Many thanks. The SOlution is very good
sha_server at 27-Aug-14 3:48am
   
thanks for the resolution
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 9

With reference to following link:
 
http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-to-iis[^]
 
Create a grant script for the new databases
 
When the application runs in IIS on your development computer, the application accesses the database by using the default application pool's credentials. However, by default, the application pool identity does not have permission to open the databases. So you have to run a script to grant that permission. In this section you create the script that you'll run later to make sure that the application can open the databases when it runs in IIS.
 

 
Run the following script:
IF NOT EXISTS (SELECT name FROM sys.server_principals WHERE name = 'IIS APPPOOL\DefaultAppPool')
BEGIN
    CREATE LOGIN [IIS APPPOOL\DefaultAppPool] 
      FROM WINDOWS WITH DEFAULT_DATABASE=[master], 
      DEFAULT_LANGUAGE=[us_english]
END
GO
CREATE USER [WebDatabaseUser] 
  FOR LOGIN [IIS APPPOOL\DefaultAppPool]
GO
EXEC sp_addrolemember 'db_owner', 'WebDatabaseUser'
GO
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

Hi Everyone,
I got this solution after good workaround, follow the link where is complete solution IIS APPPOOL\DefaultAppPoo, here also Video who describes all process to resolve the issue
 
It worked fine for me.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

Run This Script :
 
CREATE LOGIN [IIS APPPOOL\DefaultAppPool] FROM WINDOWS
GO
--USE Table Name
GO
CREATE USER [IIS APPPOOL\DefaultAppPool] FOR LOGIN [IIS APPPOOL\DefaultAppPool]
GO
EXEC sp_addrolemember 'db_datareader', 'IIS APPPOOL\DefaultAppPool'
GO
EXEC sp_addrolemember 'db_datawriter', 'IIS APPPOOL\DefaultAppPool'
GO
  Permalink  
v2
Comments
CHill60 at 22-Sep-14 17:56pm
   
Resolved a year ago!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 30 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100