none
Failed to find or load the registered .Net Framework Data Provider. RRS feed

  • Question

  • following line generate exception with message as title, but I can use the provider by adding a reference to a project, and I checked the machine.config, the provider really existed.

    DbProviderFactory factory = DbProviderFactories.GetFactory(provider);

    Tuesday, December 14, 2010 2:52 PM

Answers

  • Hi youTe,

    Thanks for your feedback.

    I have not met this problem, so I search the internet and find someone has solved the similar problem. I hope the solution can also solve your problem.

    Please refer here: http://sqlite.phxsoftware.com/forums/t/251.aspx

    The following contents are coming from @Robert:

    1.  Fix your DbProviderFactories entry in the web.config to reference the *full* assembly name instead of the partial assembly name.  Here's a "full" reference example:

    <DbProviderFactories>

      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.27.1, Culture=neutral,PublicKeyToken=db937bc2d44ff139"/>

    </DbProviderFactories>

    Notice the full reference contains the version and public key information whereas a partial reference normally does not.  A full reference allows .NET to search the GAC for SQLite.

    However, if you're deploying to a foreign machine without access to the machine's GAC or the ability to register a provider on the GAC on the destination machine, you cannot do option #1 and must do option #2:

    2.  Right-click the project, select "Add ASP.NET Folder", then select "bin".  Then right-click on "bin" and select "Add Existing item".  Then  browse for System.Data.SQLite.DLL and add it.

    Now you can leave the partial reference in the web.config like you had it before, and SQLite's DLL gets copied out to the webserver when you deploy.

     

    By the way, I find @LingZhi answer here:

    http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/029680f0-91d0-4c9a-8779-a054a1a69919

    There are two machine.config files (.NET4.0 and .NET2.0) .

     

    If you have any other questions, Please feel free to let me know.

     

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 15, 2010 8:18 AM
    Moderator

All replies

  • Could be as simple as space in the machine.config. See:

    Failed to find or load the registered .Net Framework Data Provider
    http://blogs.msdn.com/b/spike/archive/2008/07/18/failed-to-find-or-load-the-registered-net-framework-data-provider.aspx

    HTH


    This posting is provided "AS IS" with no warranties.
    Tuesday, December 14, 2010 4:17 PM
  • the blog just present the reason of error, but don't have any suggestions.
    Wednesday, December 15, 2010 1:21 AM
  • Hi youTe,

    Thanks for your feedback.

    I have not met this problem, so I search the internet and find someone has solved the similar problem. I hope the solution can also solve your problem.

    Please refer here: http://sqlite.phxsoftware.com/forums/t/251.aspx

    The following contents are coming from @Robert:

    1.  Fix your DbProviderFactories entry in the web.config to reference the *full* assembly name instead of the partial assembly name.  Here's a "full" reference example:

    <DbProviderFactories>

      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.27.1, Culture=neutral,PublicKeyToken=db937bc2d44ff139"/>

    </DbProviderFactories>

    Notice the full reference contains the version and public key information whereas a partial reference normally does not.  A full reference allows .NET to search the GAC for SQLite.

    However, if you're deploying to a foreign machine without access to the machine's GAC or the ability to register a provider on the GAC on the destination machine, you cannot do option #1 and must do option #2:

    2.  Right-click the project, select "Add ASP.NET Folder", then select "bin".  Then right-click on "bin" and select "Add Existing item".  Then  browse for System.Data.SQLite.DLL and add it.

    Now you can leave the partial reference in the web.config like you had it before, and SQLite's DLL gets copied out to the webserver when you deploy.

     

    By the way, I find @LingZhi answer here:

    http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/029680f0-91d0-4c9a-8779-a054a1a69919

    There are two machine.config files (.NET4.0 and .NET2.0) .

     

    If you have any other questions, Please feel free to let me know.

     

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 15, 2010 8:18 AM
    Moderator
  • Hi youTe,

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 21, 2010 2:19 AM
    Moderator
  • Hi Alan Chen,

    <DbProviderFactories>

      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.27.1, Culture=neutral,PublicKeyToken=db937bc2d44ff139"/>

    </DbProviderFactories>

    I used this in the app.config file and still getting the same error

    "Failed to find ot load the registered .Net Framework Data Provider"

    

    Wednesday, November 20, 2019 10:17 AM