SQL Server 2005 Express: Database is read-only

I have experience the error “Failed to update database XXX.MDF because the database is read-only” a couple of times now when working with SQL Express 2005. I got into a situation where the database file in my app data folder was in SourceSafe on my dev machine – when it was originally added it was marked as read only to all users, and when checked out, the readonly flag was unset for the current user only, not the aspnet user. The workaround to this is outlined below:

  1. (optional) uncheck “use simple file sharing” from control panel->folder options->view tab, then you see security tab for a folder
  2. Add COMPUTERNAME\ASPNET user to the app_data folder of your website
  3. Grant the COMPUTERNAME\ASPNET user write access to the folder
  4. Perform an iisreset

You May Also Like

About the Author: rnowik

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.