Thursday, December 8, 2011

How to fix: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path.

When you are getting the following error on your shared hosting 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.


You can fix it by following steps

1. Open your local data file "ASPNETDB.MDF" from you visual studio's solution explorer.
2. Right click on "ASPNETDB.MDF" and click "Publish to Provider"
3. "Script to file"
4. Click "next" or "finish" to create a script file.
5. Open the generated script file in your database's query window.
6. Make your the selected database is your main database to use.
7. Execute the script.
8. You will see asp.net application services tables in your database which are the tables with "aspnet_" prefix.
9. Change your connection string "ApplicationServices" as mention below
<add name="ApplicationServices" connectionString="Data Source=XXPC\sqlexpress;Initial Catalog=yourdb;Persist Security Info=True;User ID=sa;Password=1234;" providerName="System.Data.SqlClient" />


Now your application's membership services and user profile will be working with the database from your sql server and no more with local data file.

No comments:

Post a Comment