Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Windows 7 Beta and trying to install a web application locally. This web site uses Microsoft SQL Server 2005 Express (SQLEXPRESS) and a MDB file in the web site's ~/App_Data folder. I was instructed to configure IIS7 to use Classic .NET AppPool for this web application.

Each time the web site loads, I receive the following error:

There was an error trying to connect to the Database Server: 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 Internet is packed with articles written on this subject. The prevailing wisdom seems to be:

  1. Configure the SQL Express Service to use the Local System account.
  2. Delete the following directory: C:\Users\username\AppData\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

Neither of these fixes have made any impact. I have tinkered with permissions and settings for hours to no avail. Can anyone suggest a fix or help me understand how to get more detailed information about the problem.

share|improve this question
What service account is IIS running under? Have you tried creating an account for it? – Brent Ozar May 1 '09 at 20:48

In IIS under Windows 7, Select the application pool and then "advanced settings." Under "process model" find "Load User Profile" and set it to true.

SQL should now load under the default app pool account.

share|improve this answer
This worked for me, thanks!! – Breadtruck Jul 30 '10 at 11:22

I've had the same issues on my workstation but never on a server.

This is a temporary fix I found a while back on the web and it seems to work:

In the query editor type: exec sp_configure 'user instances enabled', 1 then: Reconfigure

Then restart the SQL Server database.

found this link today

and after a quick search on StackOverflow

share|improve this answer


For this to all make sense, firstly take a look at the Process list for all users on the Task Manager.

w3wp.exe is the new WWW worker process. It is run in a security sandbox using the permissions of a user called DefaultAppPool.

In the old days, instead of the DefaultAppPool user, it would have been IUSR and IWAM users (see ).

When you use an SQL membership provider, the w3wp.exe process will start a SQL Server User Instance and attach to the database specified in the connection string, commonly the App_Data/ASPNETdb.mdf. Running user-instance of SQL Server requires a Local Profile, so that temporary files have somewhere to go.

Troubleshooting steps:

  1. Make sure the process w3wp.exe is run by DefaultAppPool user.
  2. Make sure SQL Server has user-instances enabled (see config_value and run_value)
    exec sp_configure 'user instances enabled'
  3. If not exec
    sp_configure 'user instances enabled', 1
    then: Reconfigure
  4. Restart SQL Server, just in case ASPNETdb.mdf is attached by a different user instance of SQL Server.
  5. Make sure local user profile C:\Users\DefaultAppPool directory exists. If not, turn on LocalProfile=True, this will create the local profile. This is done in IIS Manager, Application Pools, DefaultAppPool, Advanced Settings...
  6. If you have further issues with the database, use SQL Configuration Manager to connect to the user instance and see if the db has been attached. You need to connect to the correct instance_pipe_name.
    owning_principal_name, instance_pipe_name, heart_beat
share|improve this answer

protected by Iain Aug 27 '11 at 16:55

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.