I was getting following error when I was trying to implement Roles based authentication and checking for the Roles in ASP.NET MVC application on 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. Solution
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
The solution of this problem is to configure Load User Profile
setting in IIS. Follow below steps
1. Go to IIS
2. Open the Application pool for the website you are getting error in
3. Click on Advance Settings ... in the right panel
4. Under Process Model section, set "Load User Profile" to true.
5. Click OK and refresh your website and it should work.
Thanks and hope this will help someone.