Can't connect to MySql database with Entity Framework 6 - mysql

Installed via NuGet: MySql.Data, MySql.Data.Entities, MySql.Data.Entity.
Web.config:
<connectionStrings>
<add name="WhateverEntities" providerName="MySql.Data.MySqlClient" connectionString="server=127.0.0.1;port=3306;database=dbname;uid=root;password=pass" />
<connectionStrings>
...
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
<entityFramework>
ApplicationDbContext.cs:
public ApplicationDbContext() : base(nameOrConnectionString: "WhateverEntities") {}
tried to add:
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
and:
[DbConfigurationType(typeof(MySqlEFConfiguration))]
got this error:
An exception of type
'System.Data.Entity.Core.ProviderIncompatibleException' occurred in
EntityFramework.dll but was not handled in user code
Additional information: The provider did not return a
ProviderManifestToken string.
What's wrong?

It was a matter of password as vdwijngaert suggested. Changed it in PhpMyAdmin.

Related

MySql connection with Entity Framework

I have the following code in Web.config:
<entityFramework>
<!--<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />-->
<defaultConnectionFactory type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
<providers>
<!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />-->
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<connectionStrings>
<!--<add name="EFDbContext" connectionString="Data Source=LocalPC\SQLEXPRESS; Initial Catalog=testDB; Integrated Security=true" providerName="System.Data.SqlClient" />-->
<add name="EFDbContext" connectionString="server=localhost; database=testDB; user id=root; password=test" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
However, on this line in code:
readonly EFDbContext context = new EFDbContext();
I get the following error:
> System.InvalidOperationException: 'The Entity Framework provider type
> 'MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6'
> registered in the application config file for the ADO.NET provider
> with invariant name 'MySql.Data.MySqlClient' could not be loaded. Make
> sure that the assembly-qualified name is used and that the assembly is
> available to the running application. See
> http://go.microsoft.com/fwlink/?LinkId=260882 for more information.'
I have installed MySql.Data and MySql.Data.Entity
Can somebody please help me fix this issue?

RoleProvider .NET 2 - converted from MS Access to MySQL

I have an old site running on .NET 2 using an AccessMembershipProvide and I'm changing it to MySqlMemebrshipProvider - The membership side works fine, but the roles part seems to not provide the roles methods?
If I switch back to the OdbcRoleProvide in the Web.Config it works while still using the MySqlMembershipProvider.
I'm calling the roles with: Response.Write(Roles.IsUserInRole(User.Identity.Name, "Admin") & " -role exist- " & Roles.RoleExists("Admin"))
this returns false even with logged in user.?
NOTE: I'm running it on a hosted site and don't have access to Visual Studio (I know this makes debugging incredibly difficult)!!!
Web.Config:
<connectionStrings>
<clear />
<add name="OdbcServices" connectionString="Driver={Microsoft Access Driver (*.mdb)};Dbq=e:\App_Data\subsite.mdb;" />
<add name="ConnString" connectionString="Database=Training;Data Source=localhost;User Id=myuser;Password=mypassword" />
</connectionStrings>
<system.web>
<compilation debug="true" strict="false" explicit="true">
<codeSubDirectories>
<add directoryName="VBCode" />
<add directoryName="CSCode" />
</codeSubDirectories>
</compilation>
<!--
<membership defaultProvider="AccessMembershipProvider"
userIsOnlineTimeWindow="20">
<providers>
<clear />
<add name="AccessMembershipProvider"
type="AccessMembershipProvider"
enablePasswordReset="true"
enablePasswordRetrieval="true"
requiresQuestionAndAnswer="true"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\App_Data\subsite.mdb;Persist Security Info=False"
/>
</providers>
</membership>
<roleManager defaultProvider="OdbcRoleProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<clear />
<add name="OdbcRoleProvider"
type="Samples.AspNet.Roles.OdbcRoleProvider"
connectionStringName="OdbcServices"
applicationName="SampleApplication"
writeExceptionsToEventLog="false" />
</providers>
</roleManager>
-->
<!-- http://www.codeproject.com/Articles/12301/Membership-and-Role-providers-for-MySQL -->
<roleManager defaultProvider="MySqlRoleProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<clear />
<add
name="MySqlRoleProvider"
type="Andri.Web.MySqlRoleProvider"
connectionStringName="ConnString"
applicationName="SampleApplication"
writeExceptionsToEventLog="false"
/>
</providers>
</roleManager>
<membership defaultProvider="MySqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="MySqlMembershipProvider"
type="Andri.Web.MySqlMembershipProvider"
connectionStringName="ConnString"
applicationName="ApplicationName"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="false"
passwordFormat="Clear"
writeExceptionsToEventLog="false"
/>
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" />
</authentication>
...
Not sure why reverting back to RolesProvider.vb did not cause the same response, however there was an erroneous SQL statement in the MembershipProvider.cs. This resolved the problem and the RolesProvider is responding as desired.

MySQL EF6 with MVC5 and DNX

I have a MVC5 Project, using MySQL.Data.Entity.EF6, that I am attempting to load using Kestrel (DNX).
However, I continue to get this error on Page Load:
MetadataException: Schema specified is not valid. Errors:
CMaxModel.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET
provider with invariant name 'MySql.Data.MySqlClient'. Make sure the provider is
registered in the 'entityFramework' section of the application config file. See
http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
I have created my DbContext using this configuration:
public class MyDbConfiguration : DbConfiguration
{
public MyDbConfiguration()
{
// Register ADO.NET provider
var dataSet = (DataSet)ConfigurationManager.GetSection("system.data");
dataSet.Tables[0].Rows.Add(
"MySQL Data Provider",
".Net Framework Data Provider for MySQL",
"MySql.Data.MySqlClient",
typeof(MySqlClientFactory).AssemblyQualifiedName
);
// Register Entity Framework provider
SetProviderServices("MySql.Data.MySqlClient", new MySqlProviderServices());
SetDefaultConnectionFactory(new MySqlConnectionFactory());
}
}
[DbConfigurationType(typeof(MyDbConfiguration))]
public partial class CMax : DbContext
{
public CMax(string connectionString)
: base(connectionString)
{
}
Even tho from what I've read that MVC doesn't use web.config, in the wwwroot, I have even entered into the Web.Config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v12.0"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer>
</configuration>
I am at a complete loss, any help would be appreciated.

Using a Class Library for ASP.NET Membership Provider with MySQL

I am attempting to use the ASP.NET Membership Provider with a MySQL database with mixed success. My solution currently contains an ASP.NET MVC project that has been configured to use MySQL and another project that handles all calls to the database in which I also want to handle membership functions such as creating and validating users.
Both projects have MS .NET EnityFramework v6.1.3, Microsoft.AspNet.Identity.EntityFramework v2.2.1 and MySql.Data.Entity v6.9.7 installed.
I configured the ASP.NET project as per the instructions at http://k16c.eu/2014/10/12/asp-net-identity-2-0-mariadb/. My "web.config" is configured as follows;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<remove name="LocalMySqlServer" />
<add name="LocalMySqlServer"
connectionString="Server=localhost; Database=rb-web; Uid=root; Pwd=password; Convert Zero Datetime=True; Allow User Variables=True;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
</configuration>
The instructions at http://k16c.eu/2014/10/12/asp-net-identity-2-0-mariadb/ required creating two new classes, ApplicationUser.cs and ApplicationContext.cs however these were basically replicating the code in IdentityModels.cs which was already included in my project. The identity model code is;
using System.Data.Entity;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using MySql.Data.Entity;
namespace RB.Client.Models
{
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
return userIdentity;
}
}
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext() : base("LocalMySqlServer", throwIfV1Schema: false) { }
public ApplicationDbContext(string connStringName) : base(connStringName, throwIfV1Schema: false) { }
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Primary keys can easily get too long for MySQL's (InnoDB's) stupid 767 bytes limit.
// The following lines rewrite the generation to keep those columns "short" enough.
modelBuilder.Entity<IdentityRole>()
.Property(c => c.Name)
.HasMaxLength(128)
.IsRequired();
// Declare the table name here, otherwise IdentityUser will be created.
modelBuilder.Entity<ApplicationUser>()
.ToTable("AspNetUsers")
.Property(c => c.UserName)
.HasMaxLength(128)
.IsRequired();
}
}
}
Once these changes were made I ran the Enable-Migrations from Package Manager Console and modified the Configuration.cs class as follows;
namespace RB.Client.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<RB.Client.Models.ApplicationDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
}
protected override void Seed(RB.Client.Models.ApplicationDbContext context)
{
}
}
}
I then ran the Add-Migration "Initial" and Update-Database command from the Package Manager Console which created the aspnetroles, aspnetuserclaims, aspnetuiserlogins, aspnetuserroles and aspnetusers tables in MySQL.
I then use the following code in my persistence project;
public UserDto RegisterUser(UserDto user)
{
var appUser = Membership.CreateUser(user.Email, user.Password);
}
Which raises the exception;
"Unable to initialize provider. Missing or incorrect schema."
"MySql.Web at MySql.Web.Common.SchemaManager.CheckSchema(String connectionString, NameValueCollection config)
at MySql.Web.Security.MySQLMembershipProvider.Initialize(String name, NameValueCollection config)
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)"
However, if I add the following entries to the "web.config";
<system.web>
<roleManager defaultProvider="MySQLRoleProvider">
<providers>
<remove name="MySQLRoleProvider" />
<add name="MySQLRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
applicationName="/RBWeb"
description="RB Role Provider"
connectionStringName="LocalMySqlServer"
writeExceptionsToEventLog="True"
autogenerateschema="True"
enableExpireCallback="False" />
</providers>
</roleManager>
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<remove name="MySQLMembershipProvider" />
<add name="MySQLMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
applicationName="/RbWeb"
description="RB Membership Provider"
connectionStringName="LocalMySqlServer"
writeExceptionsToEventLog="True"
autogenerateschema="True"
enableExpireCallback="False"
enablePasswordRetrieval="False"
enablePasswordReset="True"
requiresQuestionAndAnswer="False"
requiresUniqueEmail="True"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
The user is successfully created and a System.Web.Security.MembershipUser object is returned. However the call has now generated a number of new tables in the database, my_aspnet_users, my_aspnet_roles, etc along with all of the tables for profiles, personalisation, and session management even though these options weren't included in the web.config settings and the user record was created in these tables. There seems to be a disconnect between my web and persistence projects.
I have reviewed all of the articles I could find in MySQL however these all appear to be out of date and were of no help. At this point I am now writing a custom membership provider to try and get around these problems but to be honest I'm also considering ditching MySQL due to the problems I have faced trying to get this to work.

InnerException : Table 'xxx.aspnetusers' doesn't exist

I have an ASP.NET MVC 4 Web API project which uses Entity Framework 6.1.1 and MySQL 6.9.5.0. When I call /api/Account/Register using DHC, the code breaks at
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
in the AccountController and I get an InnerException which says
Table 'xxx.aspnetusers' doesn't exist
Here are pieces of my web.config
<connectionStrings>
<add name="ClockitDb" connectionString="Data Source=ClockitDb;port=3306;Initial Catalog=ClockitDb;Server=localhost;user id=root;password=m916600026;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<!-- Some code-->
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<!-- Some code-->
<system.web>
<authentication mode="Forms" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<remove name="MySQLMembershipProvider" />
<add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>
<profile defaultProvider="MySQLProfileProvider">
<providers>
<remove name="MySQLProfileProvider" />
<add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</profile>
<roleManager defaultProvider="MySQLRoleProvider">
<providers>
<remove name="MySQLRoleProvider" />
<add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</roleManager>
<siteMap defaultProvider="MySqlSiteMapProvider">
<providers>
<remove name="MySqlSiteMapProvider" />
<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</siteMap>
<webParts>
<personalization defaultProvider="MySQLPersonalizationProvider">
<providers>
<remove name="MySQLPersonalizationProvider" />
<add name="MySQLPersonalizationProvider" type="MySql.Web.Personalization.MySqlPersonalizationProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</personalization>
</webParts>
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
I had exactly the same problem .
I followed the following tutorial and it worked
How to set up application using ASP.NET Identity with MySQL Provider
It is important that you follow all the steps of the tutorial,even the migration setup, otherwise it gives the same error.
The exception clearly states that aspnetusers is missing from your database. However, on more findings, I think you would like to go through this answer from asp.net forum.
http://forums.asp.net/t/1977214.aspx?Mvc+5+Identity+Error+Invalid+object+name+dbo+AspNetUsers
For Role,Membership Provider, asp.net [entire asp.net stack/webapi included] with mysql, you need to have that providers specific to mysql in place. For this, you can refer to
http://www.codeproject.com/Articles/117157/Setting-up-MySql-Membership-with-Visual-Studio
Let me know, if this solves your problem.
I tried following the instructions on
http://www.codeproject.com/Articles/117157/Setting-up-MySql-Membership-with-Visual-Studio.
When I launch the security tab in ASP Website administration tool, I get an error saying
The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (C:\Users\Jaseem Abbas\Documents\Visual Studio 2013\Projects\MySQLSample1\MySQLSample1\web.config line 33).
My line 33 in web config starts as
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<add name="MySQLMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider,
MySql.Web, Version=6.9.5.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
connectionStringName="LocalMySqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
applicationName="/"
autogenerateschema="true" />
</providers>
</membership>
<profile>ASP
<providers>
<clear />
<add type="MySql.Web.Security.MySQLProfileProvider,
MySql.Web, Version=6.9.5.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
name="MySqlProfileProvider"
applicationName="/"
connectionStringName="LocalMySqlServer"
autogenerateschema="true" />
</providers>
</profile>
<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
<providers>
<clear />
<add connectionStringName="LocalMySqlServer"
applicationName="/"
name="MySqlRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider,
MySql.Web, Version=6.9.5.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true" />
</providers>