Alexander Beletsky's development blog

My profession is engineering

Failed to generate user instance of SQL Server exception

If you just switched from development server to IIS, you might appear to see such exception from data access layer of application:

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.

Don’t panic, it is easy to fix. Go to Internet Information Services (IIS) Manager console panel. Check out what Application Pool is set for your application, in Basic settings. It would probably be ASP.NET 4.0 Classic. Go to Application Pools section, select ASP.NET 4.0 Classic and go to Advanced Settings. In Advanced Settings. In Process Model, Identity - ApplicationPoolIdentiry would be selected.

You must change it with a credentials of user that has physical access to App_Data folder of application.

You should restart IIS and start application again.