title: Sqlite .NET and Entity Framework - "attempt to write a readonly database"
body: <p>---edit--- Is there any additional information I can give to help solve this problem?</p>
  
  <p>I'm trying to get up and running with a Sqlite and Entity Framework within a .NET WCF web service.</p>
  
  <p>When I try to save anything to the database, <strong>I'm getting the error "attempt to write a readonly database"</strong>. Here's the full error information:</p>
  
  <blockquote>
    <p>System.Data.EntityException: An error
    occurred while starting a transaction
    on the provider connection. See the inner exception for details.</p>
    
    <p>---> System.Data.SQLite.SQLiteException:
    Attempt to write a read-only database</p>
    
    <p>Attempt to write a readonly database<br>
    at
    System.Data.SQLite.SQLite3.Reset(SQLiteStatement
    stmt)<br>
    at  [snip]........................................................> 
    at System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel
    isolationLevel)    at
    System.Data.Common.DbConnection.BeginTransaction()
    at
    System.Data.EntityClient.EntityConnection.BeginTransaction()
    at
    System.Data.Objects.ObjectContext.SaveChanges(Boolean
    acceptChangesDuringSave)    at
    System.Data.Objects.ObjectContext.SaveChanges()
    at ...</p>
  </blockquote>
  
  <p>Here's my EF configuration inside Web.config (with line breaks for easier reading):</p>
  
  <pre><code>&lt;connectionStrings&gt;
     &lt;add 
        name="FooEntities" 
        connectionString="metadata=res://*/FooDataModel.csdl|
        res://*/FooDataModel.ssdl|
        res://*/FooDataModel.msl;
        provider=System.Data.SQLite;
        provider connection string='data source=C:\domains\myfoosite.com\wwwroot\FooService\Foo.sqlite'"
        providerName="System.Data.EntityClient" /&gt;
  &lt;connectionStrings&gt;
  </code></pre>
  
  <p>Why am I receiving this error? Why is the database read-only?</p>
  
  <p>Some things I've tried:</p>
  
  <ul>
  <li><p>Ensured the directory and file is
  write-able by the web service. (I've
  tried writing plain text files to the
  same directory as a test.)</p></li>
  <li><p>I've added the 'read only=False' to
  the connection string.</p></li>
  </ul>