locked
Unable to find the requested .Net Framework Data Provider RRS feed

  • Question

  • User-1466445078 posted

    Hi,

    I know similar issues to this have been asked before and I've read all the other posts but I'm still stuck.

    This is my first Web Pages (WebMatrix) site. I'm using WebMatrix on my local PC and the site I've created runs fine. The site uses two databases, a SQL Server Compact database (.sdf) which is used for the Membership/Security part of the site (users) and a MySQL database for the rest of the site (this is because, so I understand MySQL can't be used for Membership/Security).

    (prior to Web Pages/WebMatrix I've developed Classis ASP sites connected to a MySQL database so I'm using the MySQL server running on our (development) Network server (Windows 2008 R2) as the MySQL connection in WebMatrix - eventually the site will be moved to a live web server but our development server is IIS7 with ASP.NET 4.5).

    Everything works fine when I view/run the site from WebMatrix using the localhost mini IIS that comes with WebMatrix. I now need to move the site to IIS on our Network server. I've ensured our server is running ASP.NET 4.5 and MVC 3 and installed Web Deploy. The Application Pool is using ASP.NET 4. The new site is set up in IIS and the publishing settings file was created.

    Back in WebMatrix I "published" the site to our network server using the publish setting files provided by Web Deploy - I selected to NOT publish the MySQL database as it's already on the network server.

    Everything "published" ok (no errors) but when I run the site on the network server I get this error message:

    Server Error in '/' Application.


    Unable to find the requested .Net Framework Data Provider.  It may not be installed.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.

    Source Error: 

    Line 1:  @{
    Line 2:      WebSecurity.InitializeDatabaseConnection("procdusers", "UserProfile", "UserId", "UserName", true);

    where "procdusers" is the name of the SQL Server Compact database (.sdf) that contains the users., This database has been copied to the server (by the publish process) and I can see it in the App_Data folder. In the "bin" folder I can see a System.Data.SqlServerCe.dll file which, I assume, is to do with this type of database.

    In my web.config file there is no "connection string" for the SQL Server Compact database - should there be? - there is one for the MySQL database, here's an extract of the web.config file:

    <system.web>
    <compilation debug="true" targetFramework="4.0"><assemblies><add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /></assemblies></compilation>
    <authentication>
    <forms timeout="10080" />
    </authentication>
    <httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" maxRequestLength="32768" />
    <customErrors mode="Off" />
    </system.web>
    <connectionStrings>
    <add connectionString="server=123.123.123.123;database=mysqdbname;uid=myusername;pwd=mypassword" name="mysqldbconnname" providerName="MySql.Data.MySqlClient" />
    </connectionStrings>

    (The entry in connectionStrings is for my MySQL database which I've modified for this post to hide username and password etc)

    I'm stumped to know what else to do or try - can anyone help?

    Many thanks.

    Wednesday, July 23, 2014 7:34 AM

Answers

  • User-821857111 posted

    Try adding this to your web.config:

    <system.data>
      <DbProviderFactories>
        <remove invariant="System.Data.SqlServerCe.4.0"/>
          <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      </DbProviderFactories>
    </system.data>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 23, 2014 8:26 AM

All replies

  • User-821857111 posted

    Try adding this to your web.config:

    <system.data>
      <DbProviderFactories>
        <remove invariant="System.Data.SqlServerCe.4.0"/>
          <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      </DbProviderFactories>
    </system.data>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 23, 2014 8:26 AM
  • User-1466445078 posted

    Thank you, thank you, thank you.

    That worked.

    You're a star!

    Wednesday, July 23, 2014 8:34 AM