Saturday, October 6, 2007

Another reason for "Failed to Update Database ..\App_Data\aspnet.mdf because database is readonly

I am currently working on ASP.NET 2 project. After working for 2 days and creating an outline for the site and flow for user interaction, I decided it was right time to put it into source control.

After I added it to source control it started giving me giving strange "database is read-only problem". I googled a bit about it. The solutions offered ranged from giving IIS process, ASPNET user and don't remember who else to give access to app_data folder. But it did not work.

Then there was an elaborate solution using command line sseutil . It recommended to detach the database and reattach it. After some futile attempts, I had to close VS, and restart Sql Express.

Again today some how I checked in all the files in solution and it again gave gave me same problem when I tried to create a Stored Procedure. Then occurred to me that maybe it is because the database file is checked in source control and is read-only (it was checked in). I detached it (with sseutil of course), checked out the file (aspnet.mdf) and it is working again alright.

No comments: