14

I'm having a little bit of a problem that I thought was related to Security but, turns out can't be as I did almost everything ...

Plenty of information on this on the web but nothing has an answer to fix the issue.

Let me tell my steps:

  • Have a Website on VS2k8 that when I debug or start from Cassini, all works fine
  • When setting up IIS 7.5 (Win7) to point to this website and after adding IIS_IUSRS Modify rights I get the error
  • Same thing using IIS 6.0!

Img: Security on Database File from IIS 7.5

alt text
(source: balexandre.com)

Note that all other files and folders have the same rights as above

The full Error is:

Log: Executing query on SQLite Database

Message ***************************************
Attempt to write a read-only database
attempt to write a readonly database

Stack Trace ***********************************
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
at soDatabaseManager.CommitPersonsToKitchenDatabase() in c:\Adwiza\Kitchen\App_Code\soDatabaseManager.cs:line 242

P.S. Keep in mind that this has to work with IIS 6 (windows 2003) as well, the IIS 7.5 is only for troubleshooting as we have more control in everything...

2
  • Did you check read only state of file? Commented Feb 25, 2010 at 9:51
  • 1
    Yes I did, it is not read-only, non of the files in IIS are :-/ Commented Feb 25, 2010 at 10:03

3 Answers 3

16

Make sure that the anonymous web user account (NETWORK SERVICE or maybe something else) under which your web application executes has read/write/create/delete access to the folder where the sqlite database resides.

Sign up to request clarification or add additional context in comments.

1 Comment

under IIS 7.5 you can choose wither to use a USER or Application, my anonymous User is IUSR (as you can see, it exists in the Security Panel) and I have the same error on using Application Pool identity (img: balexandre.com/temp/2010-02-25_1150.png )
3

The other answer give me an idea about the problem, but my solution was a bit differente. The problem was that the user did not have permissions to modify the folder and the .db file. So I give permission to the user Everyone (collective group for Authenticated Users and Guest). The permisions on NETWORK SERVICE (or similars) did not solve in my case.

Note: The IIS must be restarted, after the change, to load the change made.

1 Comment

For me, it was the application pool identity, but +1 for advice to restart - but that only applied to the application pool itself, in my case. Not all of IIS.
-1

ss----enter image description here

You should also do this. error for--->Unable to open the database file You must add a connection string.--"Version=3;Mode=ReadWrite;New=False;Compress=True;Journal Mode=Off;";

1 Comment

Images of text is a bad idea (they can't be searched, external sites take them down sometimes), rather copy and paste the text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.