title: Trying to acces MySql database in ASP.NET MVC
body: <p>I'm new at ASP.NET MVC and I'm writing an ASP.NET MVC application with my own MySQL database. I've customized the code to connect to the database and i think everything has to work fine. When i use my own testdata in DeelnemerRepository (UserRepository in english) I don't have any problems but when i try to access the database it throws an ArgumentException. The exception also gives me the following message: </p>
  
  <blockquote>
    <p>Unable-to-find-the-requested-Net-Framework-Data-Provider-It-may-not-be-installed</p>
  </blockquote>
  
  <p>The invoked method in the DeelnemerRepository:</p>
  
  <pre><code>public IQueryable&lt;Deelnemer&gt; FindAll()
  {
      return deelnemers.OrderBy(d =&gt; d.Emailadres);
  }
  </code></pre>
  
  <p>With NuGet i added MySql.Data, MySql.Data.Entities and MySql.Web</p>
  
  <p>The Connection strings in the web.config file: </p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-ProjectDynamische-20130415102959;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-ProjectDynamische-20130415102959.mdf" providerName="System.Data.SqlClient" /&gt;
      &lt;add name="kindermishandeling_dbContext" connectionString="server=localhost;Port=3307;User Id=root;password=1234;database=kindermishandeling_db;Persist Security Info=True" providerName="MySql.Data.MySqlClient" /&gt;
    &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>I also found out there could be a problem in this method in this class but I'm not sure:</p>
  
  <pre><code>private class SimpleMembershipInitializer
          {
              public SimpleMembershipInitializer()
              {
                  Database.SetInitializer&lt;UsersContext&gt;(null);
  
                  try
                  {
                      using (var context = new UsersContext())
                      {
                          if (!context.Database.Exists())
                          {
                              // Create the SimpleMembership database without Entity Framework migration schema
                              ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                          }
                      }
  
                      WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
                  }
                  catch (Exception ex)
                  {
                      throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                  }
              }
          }
  </code></pre>
  
  <p>I don't expect a solution for the problem but i just would like to know where i have to look, I think ASP.NET MVC is really complicated...</p>