How To: Fix database access permission on IIS
Issue:
When deploying your web application to IIS that uses SQL Express database, you get an error stating that “Failed to update database ‘APP_DATA\XXXX.MDF’ because the database is read-only”.
Here’s how you can fix it:
- Make sure App_Data directory or any contained files does not have file system attribute Read-only set.
- Give user ASPNET and NETWORK SERVICE Modify control over the App_Data directory.
- Run IISRESET to restart IIS to refresh its permissions