Wcf – Exception when deploying to IIS: Login failed for user ‘IIS APPPOOL\DefaultAppPool’


I'm working through some WCF examples in "Windows Communication Foundation 4 Step By Step". My resulting application runs fine as long as the service is hosted in casini. It fails when I deploy the service to local IIS. When deployed to IIS, I can browse to the svc page in IE. That works.

According to the book, page 41, the app pool account needs to be a member of the db_owner role in my database. The author suggests, after verifying the correct address of the service (already did that), checking the permissions of the app pool account.

How do I verify which account is used by the application pool hosting my WCF service? Currently using the default app pool and IIS APPPOOL\DefaultAppPool is in the db_owner role. IIS APPPOOL\ASP.NET v4.0 is also in the db_owner role.

The exception is…

System.Data.SqlClient.SqlException: Login failed for user 'IIS APPPOOL\DefaultAppPool'.

How do I troubleshoot this issue? Thanks!

Best Solution

Solution found here:

  • Open IIS
  • double click your PC name under Connections
  • Click Application Pools
  • Select your app pool (DefaultAppPool)
  • Then under actions on the right click Advanced Settings,
    • Go to Process Model section and
    • click on Identity.
    • Now select NetworkService.