I generate my databases on the fly while using Active Record.
Every time I start a new project and fire up the app to auto-gen the SQL Express DB I get this 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.
… and it drives me nuts. I work on a project just long enough to forget what I did to fix that error. I’m going to document it here.
The reason this is happening is because the user instance that I’m running IIS under does not have the proper credentials. You can fix this by creating a new app pool in IIS, and having it run under a user that has the rights to create a db (most likely your own account). What I do is create an AppPool called “PrivilegedAppPool” and have it run under my own account. Then restart IIS and you should be able to create your db on the fly.
Presto. No more errors.