Failed to generate a user instance – MSSQL

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.

I’m currently working on a project using .NET 4, MVC 3 and MSSQL Server 2008 Express. The live test server is IIS 7.5 on Windows Server 2008R2, and the development environment is a Windows 7 Ultimate and Visual Studio Web Developer 2010 Express.

For this project, I wanted easy deployment to the test server including the database. That’s why I’m using an .MDF file in the App_Data folder.

However, it gave me a lot of pain when deploying it. I kept getting the quoted error. A lot of googling didn’t help. Most of the suggestions was “missing permissions” or that the app pool’s user needed to have a local user profile on the server. That just didn’t satisfy me.

But a tiny little switch saved my day:

In the advanced settings of the application pool, “Load User Profile” was set to False. Even though False was bolded, it seems to be the default settings. Switching it to True and recycling the pool solved the problem.

Leave a Reply

Your email address will not be published.