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

asp.netiis-7sql server

net project in vs2010 i have a db and table inside the app_data folder, i have created a deployment package and have imported the package into an iis server that is installed on my local mechine.
now i get this error message while trying to preform an insertion.

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

the connection string is:

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\survey.mdf;Integrated Security=True;User Instance=True

when running it inside VS2010 it`s working fine.

how can i solve this probelm ?

Best Answer

Remove the User Instance=True. You don't need RANU instances. Next, make sure the SQL Server Express service account had the proper needed rights on your app_data:

cacls <path\app_data> /E /T /G SQLServerMSSQLUser$<ComputerName>$SQLEXPRESS:F 
Related Topic