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

2011-01-30 13:55:19 +0000

I’m spiking a WCF service hosted in IIS this weekend. It uses SQL Server, and I was getting the following error in WCF Tracing:

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

Fortunately, I quickly found this thread on the ASP.NET forums. To summarise:

For the last part, you can add the login to the db_owner role during development, but you really ought to lock the permissions down properly (give SELECT / INSERT / etc. permissions as appropriate).