Failed to update database because it is read-only

I have set up my website to use ASP.NET Membership. it all works fine when trying to use it on my development machine but when I put it on the web server and try to log in, I get this error :

"Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only. "

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

thanks for the help. I just found a solution. in the App_Data ACL, I had two entries : Network Service and IIS_IUSRS. the Network Service account had full permissions but IIS_IUSRS group had only read access. so, I gave IIS_IUSRS full permissions as well and it worked !

thanks again.

Method 2

Don’t forget to restart the IIS with “iisreset.exe” after altering the permissions

Method 3

Check that file on the disk. Right click and go to properties.

If it is a read-only file, you will need to make it writeable.

Method 4

If the file is read-only and you can’t seem to change it using the Properties window, you have to use a command prompt.

Refer to this Support article at Microsoft.

Method 5

The user account that the website is running under needs write permissions on the file.

It is also likely that the file is read-only as result of the transfer and needs to be set to be writeable.

Method 6

I followed Attilah’s answer and found:
1. Both IIS-ISUR, WebService had full pomission to the App_Data and the mdf.
2. But someone called “asp.net 4.0 pool” and “all users” did not, so I allowed them.

Then
3. I followed user1280392’s answer to run “iisreset” but failed (but still run it pls).

Then I went to IIS manager and did this:
4. Clicked the server’s name, clicked “restart” on the right.
5. Clicked the applications name, clicked “restart” on the right.

and it was ok.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x