This evening I was experimenting with a sample web application we’ve been working on. After installing the sample I went to the admin page to verify that the database could be connected to. I got an error that I hadn’t seem previously in any of our testing (on XP and Vista):
System.Data.SqlClient.SqlException: 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.
After checking all the normal things I thought to poke a bit further into IIS to see if I could work out what was different. I’ve only been using Windows 7 for a couple of days now but I’m already so used to it that I forget I’m running it and that some things may be different. It seems that where under Vista our application installs and uses an application pool that uses the NetworkService account, it appears that under Windows 7 it uses the ApplicationPoolIdentity.
The trick to getting the site to work was to simply create a different application pool (always good practice) which uses the NetworkService account.