This is occurring because you have asked for the connection to be made using a trusted connection, which means that the operating system user that the code is being executed as will be the one connecting to the database.
In the case of IIS, the operating system user is usually defined in the IIS Application Pool unless you have specified impersonation to be used in web.config.
By default (in order to prevent security issues), the default identity used for IIS Application Pools has a very limited capability. Depending on your configuration (where SQL server is in relation to IIS (same machine, different machines), you may need to either specify a different identity for the app pool and/or you may need to grant authority to access SQL Server to the app pool identity.
This Microsoft article has additional information on how to configure ASP.Net impersonation.
We always configure our web applications to impersonate a domain user so that we can access databases and other resources on remote machines without having to affect the IIS application pool settings.
SQL server 2012 Enterpriseand can you please explain a bit how can i add this permission to sql? and do i need to change this everytime i make some changes to app pool?Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.