FluentConfigurationException - sqllite

Original Post Chris Fletcher's Avatar

Chris Fletcher

19 Apr, 2010 11:31 PM via web

Hi,
I've followed the instructions (or atleast I think I have) attempting to get fluent nhibernate setup in an asp.net mvc project using sqllite. I've attached the code for clarity, but I get a 'FluentConfigurationException' within my CreateSessionFactory Method (originating after the SchemaExport attempts to run). The innermost exception says "Unable to open database file", what is strange is I get this exception on VS2010 RC on my windows 7 machine at home, but I don't get it on my server2008 machine at work where it works as expected (VS2010 RTM). The build is set to x86 mode and I have the right sqllite dll for it I believe.
I realise this could be a sqllite issue but I thought it best to start here, does anyone know why I'm getting this issue here and how I might solve it?

Thanks

  1. Support Staff 2 Posted by Paul Batum on 20 Apr, 2010 12:30 PM

    Paul Batum's Avatar

    Sorry if this is really obvious, but have you got the DB file on both of your machines? It sounds like you're not using the in-memory mode, and are instead using a file as the db storage, so of course you are going to need that file to be on your home machine as well.

  2. 3 Posted by Chris Fletcher on 20 Apr, 2010 01:05 PM

    Chris Fletcher's Avatar

    I was under the impression that the code I attached (which I cant see, I'll re-attach) would recreate the database file from scratch every time (my next step was to put together a method to insert some test data). I'm carrying the project on a usb drive anyway though so the solution is kept on the same physical disk.

  3. Support Staff 4 Posted by Paul Batum on 25 Apr, 2010 01:45 PM

    Paul Batum's Avatar

    You're right, the code you are using should create the db file.

    I haven't come across this error message before. Maybe its some sort of permissions problem?

    I would consider writing a tiny test app that interacts with sqlite directly to create a file-backed db and then run it from your usb drive. If that works on your server2008 machine and fails on your home machine, then that tells us that its not really a nhibernate problem and more about the nature of running of the USB on win7.

  4. 5 Posted by Berryl on 06 May, 2010 04:27 AM

    Berryl's Avatar

    Hi Chris

    I am guessing your home box is under 4.0 and your work box is earlier. There is a dependency in the SQLite dll on SqlData 2.0. Try putting BOTH of the below in app or web config if so

    HTH,
    Berryl

    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    <requiredRuntime version="v4.0.20506"/>
    
    <loadFromRemoteSources enabled="true"/>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="System.Data" publicKeyToken="b77a5c561934e089"/>
          <bindingRedirect oldVersion="2.0.0.0" newVersion="4.0.0.0"/>
        </dependentAssembly>
      </assemblyBinding>
    
    </assemblyBinding>
    
  5. Support Staff 6 Posted by Paul Batum on 16 May, 2010 06:50 AM

    Paul Batum's Avatar

    Did you ever figure this one out Chris?

  6. 7 Posted by Joe Benckert on 03 Jul, 2010 12:26 AM

    Joe Benckert's Avatar

    So, I had this same issue. Windows 7 - VS 2010. After struggling and googling for quite a while I decided to run VS as an administrator and all was well; definitely a permissions issue.

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What is the number before twelve?

    Recent Discussions

    05 Jul, 2010 10:29 PM
    05 Jul, 2010 12:45 PM
    05 Jul, 2010 12:42 PM
    05 Jul, 2010 12:17 PM
    05 Jul, 2010 12:12 PM

     

    03 Jul, 2010 12:26 AM
    02 Jul, 2010 02:17 PM
    02 Jul, 2010 08:18 AM
    02 Jul, 2010 12:20 AM
    01 Jul, 2010 10:14 PM