Skip to main content

SqlException: Login failed for user 'IIS APPPOOL\

This issue is related with the permission for application pool to connect with the sql.
We can create login user with the name as specified in the exception IIS APPPOOL\<name>
and grant permission to the database.
We can create new login user by opening the SSMS(Sql server management studio) navigate to Security>Login 
Then Add the user by right clicking Login and selecting new login
While creating user Navigate to UserMapping and tick the database for the specific user.

This process will create the new user and gran permission to the user.



Another Work Around
Yet another simple way will be to change the application pool Identity property To LocalSystem by navigating to the application pool and then advance setting.

Comments

Popular posts from this blog

Connection String in ASP.NET With SQL Server

Connection string can be placed in web.config file found in root directory of the application from .NET 3.5 onward. connection string can be specified with an xml tag  <connectionStrings>  inside  <configuration>  section of web.config file. < connectionStrings > < add name = "myConnectionString" connectionString = "Data Source=databaseServerName; database=database-name; uid=sqlUserName;password=sqlPassword; Integrated Security =True|false|SSPI (any one options) ; " providerName = " System.Data.SqlClient System.Data.SqlClient" /> </ connectionStrings > We can use local database server of SQL Server by using Data Source= (LocalDb)\MSSQLLocalDB we can attach a local database file to the app_data directory by using the property AttachDBFilename=|DataDirectory|\appDatabaseName.mdf in the connection string Connection String can be

Using SqlDataAdapter to fill DataTable in c#

public DataTable List(string sql)         {             SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);             SqlCommand cmd = new SqlCommand(sql, con);             DataTable dt = new DataTable();             SqlDataAdapter da = new SqlDataAdapter(cmd);             try             {                              con.Open();                 da.Fill(dt);             }             finally             {                 con.Close();             }             return dt;         }