views:

2049

answers:

3

Hi,

I have a ASP.NET MVC app that is using SQLite database through Entity Framework. Everything works on VS 2008's local development webserver.

However, deploying the web app to my service provider causes this error:

[ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.]
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1308959
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +35

Service provider has commented that they do not support SQLite. I had though that SQLite is independent of service provider's settings since it's App_Data deployable.

Has anyone experiences of a succesfull Entity Framework + SQLite deployment?

Cheers, -pom-

A: 

Have you tried adding the required DLL(s) to your application's bin directory? You might want to look at Phil Haack's article on Bin Deploying ASP.NET MVC for ideas on how to do this automatically.

tvanfosson
Hi, thanks for an answer. Yep, I've seen Phil's blogpost. I can deploy normal ASP.NET MVC app just fine. It's the combination with Entity Framework + SQLite that is problematic. I've upped both System.Data.Entity.dll and System.Data.SQLite.dll to bin folder. No luck yet.
Pompair
Hmmm. Are they in your assemblies section in the web config?
tvanfosson
+6  A: 

You're unlikely to be reading this anymore, but you're missing the following in your app.config (or, for you, web.config):

<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" 
           description=".Net Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
</configuration>

Specifically, if you're using sqlite in a library which is linked into your website, it's not sufficient to put that into the app.config of the library it's got to go into the website. This is because of how you're loading the provider: essentially, you're determining at runtime which dll to load, using the string "System.Data.SQLite", and locating the appropriate provider is done using the settings of the entry assembly.

Eamon Nerbonne
Thanks for the answer...
Funky81
Thanks. This worked for me too: in a wpf application that referenced a class library with SQLite data access.
Ole Lynge
A: 

SQLite needs full trust permission for ASP.NET application deployment. Many shared hosting providers don't allow that. You might wan't to check this.

Ajit Singh