posted on Sunday, June 12, 2005 11:53 PM by leon

Unable to Update Default User Database from ASP.NET 2.0 site, published to IIS

In VS2005 beta2/MS-SQL EXPRESS if you are publishing your site to IIS virtual directory, attempt to access default user database (App_Data\aspnetdb.mdf) will fail. You will likely receive error message similar to this:

Failed to update database "D:\WebSites\ASPNET20CC\App_Data\ASPNETDB.MDF" because the database is read-only.

To reproduce the problem:
  1. Create simple web site with LoginControl and CreateUserWizard
  2. Publish site to IIS
  3. Browse login page from IIS virtual directory instead of Casiny
  4. Try to create new user or login with existing one
To fix the problem:
  1. Detach aspnetdb database from SQLEXPRESS using sseutil.exe utility.
  2. Remove *.mdf and *.ldf files from App_Data application directory
  3. Grant Read/Write access on App_Data to working process identity (ASPNET for IIS5.X or NETWORK SERVICE for IIS6)
  4. Copy *.mdf, *.ldf files back into App_Data folder
  5. Run application, refresh if any connection related error received

This bug is announced and fixed in later build of SSE. You can see full description here.

Comments