Related Items

Wednesday, April 22, 2020

Login failed for user 'IIS APPPOOL\

Sometimes, when we run an ASP.NET on IIS Server, it generated an error :


Login failed for user 'IIS APPPOOL\



like this in th picture. 


The solution for this error, you need to open SQL Server Management Studio, run this script below.



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

And then, Right Click on database name that you use on that program and then choose Properties, and then click for Permissions and then check the name for WebDatabaseUser and grant the permissions.


In the connection string you must add 

Trusted_Connection=false;
 
Finish, lets try the program......

1 comment:

  1. I like the useful info you provide. Pay a visit this 3 hours essay website. I'm quite certain I will learn lots of new stuff right here!

    ReplyDelete