0

I'm facing with strange problem with SimpleMembershipProvider. I ran an example MVC4 project in VS11 and created my own database which contains table "userprofile" with two fields "UserId" and "UserName". Moreover I connected my MySQL database with Entity Framework and generated model from the DB.

Then I tried to deal with membership provider and I faced with some problems. Actualy, I've done everything what is written in this article:

http://deresegetachew.wordpress.com/2013/01/20/websecurity-initializedatabaseconnection-throughs-an-exception-unable-to-find-the-requested-net-framework-data-provider/

No reason why in line with:

WebSecurity.InitializeDatabaseConnection("ParserEntities", "userprofile", "UserId", "UserName", autoCreateTables: true);

I'm getting an exception:

The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588"}

That's how my connection string looks like:

    <add name="ParserEntities" connectionString="metadata=res://*/ParserModel.csdl|res://*/ParserModel.ssdl|res://*/ParserModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;database=parser&quot;" providerName="System.Data.EntityClient" />

Thanks for any help!

tereško
  • 58,060
  • 25
  • 98
  • 150
elklusek
  • 49
  • 7
  • I wrote my own Provider for MySQL. The simplest solution is to create a new class provider which will inherit from `MembershipProvider` and implement methods which you are interested in. For sure, you need to implement `ValidateUser` method. Sorry for taking soo long to answer the solution but too many other things to do. – elklusek Mar 28 '13 at 07:45

2 Answers2

0

SimpleMembershipProvider uses a Code first database context. It does not work with a DatabaseFirst (edmx based) connection string that uses an EntityClient sql provider.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
0

I create MySqlSimpleMembershipProvider on GitHub and make sample projects.

https://github.com/xyz37/MySqlSimpleMembershipProvider

That's all.

Thank you for the answer to this question.

Click to sample screenshot : https://raw.github.com/xyz37/MySqlSimpleMembershipProvider/master/_ScreenShot/SimpleMembershipProviderTest.png

Kim Ki Won
  • 1,795
  • 1
  • 22
  • 22