Question

This message appears every time I try to save the data to the DB.

Failed to update database because the database is read only

Note: This error comes only when the application is installed to C drive.

Front End: VB.NET

Back End:SQL Server

Is there any way to overcome this issue? Or any way to restrict the user from installing the application on C drive?

Was it helpful?

Solution

I would check the file system privileges. I suppose you talk about an SQL server file database. You receive the message because the account trying to access your file database does not have the file system permissions to do so.

  1. In order to confirm my suggestion, you allow everyone to access the specific directory with full permissions.

  2. Then, you have to check what is the account trying to do the actual access. Probably it's a system account (user ASPNET or NETWORK SERVICE). You have to give the respective permissions to the specific account.

  3. Then, restart IIS.

If you want to do this for a distributed stand-alone application. Then these permissions would have to change on each machine where the program would be installed. In order to avoid putting users in such a fuss, the setup program should do it. I am not an expert on setup programs, but even the simplest ones would give you the option to do it, after asking the system adminstrator's approval. I suppose you could build a custom action during the setup program which would change the specific folder's permissions, perhaps by using xcacls.exe.

Hope I helped!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top