Basically this problem comes up when we work with Asp.Net Application With IIS Server. I got this error while working with Asp.Net MVC Application. When I run My MVC application suddenly I got this error:
“System.Data.SqlClient.SqlException was unhandled by user code: Login failed for user 'IIS APPPOOL\DefaultAppPool’” and database connection couldn't open.
There are some step for solving this problem.
- Go to your Run Window and there you type “Inetmgr” and click oK ( Means Go to IIS Server).
- Here you will IIS Server window , from this window you go to “Application pools” and then select “DefaultAppPool” Right click on it and select “Advance Settings” and click on that.
- When you will click on Advance settings link it will open Advance setting window there you select “Identity” (In Process Modal) and Change the path from ApplicationPoolIdentity to LocalSystem.
When you click on this Path, three dotted buttons, a window will open from there “Built-in-Account “radio button contain a dropdown box , from this dropdown box you change this path and the click OK.