solution:Failed to update database "XXX.MDF" because the database is read-only.

As usual I did Build - Publish Web Site and then copied and pasted the published directory to my web server. When browsing any of the web pages that use the SQL Server 2005 database I get this error message: Failed to update database "XXX.MDF" because the database is read-only.

 

Solution:

This worked for me:
1) Make sure App_Data directory or any contained files does not have file system attribute Read-only set. (I had some files marked as Read-only)
2) Give user ASPNET and NETWORK SERVICE Modify control over the App_Data directory. (I had to add both these)
3) Run IISRESET to restart IIS to refresh its permissions.

 

and step 2 works here:

 after selecting "properties on the "App_Data" directory,

1.  Select the security tab

2. CLick on Add... under "Group or User names:" table

3. On the next window, select Advanced, another window appears and on this, select or rather click on "find now" and a list of Groups and Users should appear on the bottom table.

4.  Click on ASPNET followed by OK, and the same on the next 2 windows.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章