@bobnoordam

Failed to generate a user instance of SQL Server due to failure in retrieving the user’s local application data path

When publishing a web application which includes an integrated SQL database you receive the following error:

Failed to generate a user instance of SQL Server due to failure in retrieving the user’s local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

Cause: The user identity your application is trying to create an instance of the SQL server with, does not have a profile on the computer. You need to change this identity to a valid user. Resolution:

  • If you are already impersonating a non system account, log in to the local system using that username. This will create the missing profile.
  • If you are currently using a system account for the connection, change it to a valid user account on the machine. To do that: In IIS Manager, change the Apllication Pool identioty to a valid local user with a profile