Anyone trying to solve this error I would recommend trying these steps - I searched for 3-4days solid trying to resolve this..and now I have.
Firstly My Specs:
- Windows Server 2008
- SQL Server 2005
- Visual Web Developer 2008 Express Edition
Ok so firstly I developed an application using the ASP.net 3.5 Login controls - I did this on a windows vista machine that was using SQL Server 2008. It worked perfect on local server, but when I uploaded to my main server and published it on my domain I kept recieving the errors:
Failed to generate a user instance of SQL Server due to a
failure in starting the process for the user instance. The connection
will be closed.
Also i got the 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 I found my error may be related to:
You cannot connect to Visual Studio SQL Server Express on a remote Windows XP Service Pack 2-based computer
I also noticed that inside the Asp.net Configuration website from Visual Web Developer it wouldnt allow me to create new users, or manage users. This was also how i fixed that:
Here is how I resolved it.
Step 1 - Check your instance name/connection string.
Firstly make sure your instance name is the same for both your connection string and your SQL Server. To do this simply check your connection string, identify the instance name e.g.
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True; User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />
In this case SQLExpress was my instance name - So then go into your SQL Express configuration double click on "SQL Server 2005 Services" inside there you should see "SQL Server (......)" where ...... will be your instance name. - Make sure this matches your connection string.
Step 2 - Add line to your connection string
Add <remove name = "LocalSqlServer" /> to your connection string. So you should have something like this
<connectionStrings>
<remove name = "LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True; User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />
</connectionStrings>
Step 3 - Make sure your Connection string inside web.config matches your IIS Connection String
As mentioned above you need to make sure they match up - What I did was go into your IIS Manager - Start --> Administration Tools --> IIS Manager -->Connection Strings
Make sure the value inside the LocalSqlServer connection string matches that one listed in your web.config file.
Step 4 - Create & Configure your applicaiton pool
Go into your application pools - Start --> Administration Tools --> IIS Manager --> Application Pool
Create a new Application Pool - Cool it what you want - set the .net framework version to .Net Framework V2.0.5
Set Managed Pipeline Mode to Integrated - and check the Start Application pool immediately
Click Ok - And then right click on the Application pool you created in the list and click "Advanced Settings"
Under "Process Model" change "Identity" to LocalSystem
Step 5 - Finally - Change Your Applications/Websites Application Pool
Go into the applicaiton pool containing your website/Application - Once you have found it right click it from the list and click "Change Application Pool" - Once the box opens - change the application pool to the newely created app pool
That should then resolve your issues.