I crated an app with asp.net mvc using entity framework 4 and sql server 2008.
Everything works well on localhost but when i move to iis i get this exception:
Cannot open database "Template" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.
You can either update your connection string to explicitly have a valid user name and password to login to your SQL Server or you can change the identity that the DefaultAppPool process is running under inside IIS.
For the first one, you have to create a login name inside your SQL Server with having sufficient access to your target database.
For the second one you have to go to IIS => Application Pools => Default App Pool => Set Properties => Process Model => Change Identity to LocalSystem or your Custom Login.