Login failed for user 'IIS APPPOOL\ASP.NET v4.0'

Web Application that are hosted on IIS try to access the database using the application pool.
Sometimes the application pool does not have sufficient permission to access the database.
In such situation, this error happens.
First of all on SQL Management Studio, navigate to Database--> Security--> Users
Check whether the User IIS APPPOOL\ASP.NET v4.0 is listed or not?.
If not present, create new user by right clicking the Users icon as shown below.

On User Name section give the name as IIS APPPOOL\ASP.NET v4.0 as shown below.

On Databse Role Membership section, check both db_datareader, db_datawriter.
Click OK button and browse again.
This will definitely resolve the issue.