#Google Analytic Tracker

Pages

Jan 27, 2007

ASP .NET Issue: Failed to update database XXX because the database is read-only

Story (Skip this part if you want the solution) Since I don't have a job and have quiet a bit of free time, I started playing around ASP .NET 2.0 and setting up my own webpage. At the same time, I was investigating how to setup a ASP DetailsView Control because it is extremely useful if you want your webpage to be dynamically data-driven. I have two machines at home. The faster computer, which sit in my room is used for my daily computer activities and software development (non-work related), and the 2nd computer which is only a Pentium 800 runs an IIS server. After I design and tested the ASP DetailsView control on the development machine and tested it locally, I copy the files to the IIS server. Loading the information from the DetailsView doesn't have any problem, but when I update the content. this is what I got:
Solution: I know that this has to do with some security issue, but I was thinking it is something due with SQL connection string. But lucky someone has find a solution that works for me: Tjitjing Blog
  1. Make sure your database .MDF and its corresponding log file LDF is not read only. These file usually stored in your App_Data project folder .
  2. Right Click and select property of your App_Data folder.
  3. Under Security tab, add ASP .NET and NETWORK SERVICE users, and allow Modify permission. Apply the setting
  4. Restart you IIS - you can go to your IIS mmc console, right click on your IIS Server (in my case it is the local computer), select All Tasks->Restart IIS. (IIS ver. 5.1)
Then test your web page to see if it works.

No comments: