0

I'm trying to add membership provider with ASP.Net MVC4 and EntityFramwork Database first model. I'm using VS Express 2012 for web, EF 5, and MVC 4.

I have two projects inside my solution.

  1. iTMS.DAL - Contains EntityDatamodel for existing database.

  2. iTms.Website - Contains MVC4 Project.

I did following things

  1. Created membership tables in SQL server 2014 using aspnet_regsql.exe.

  2. Modified InitializeSimpleMembershipAttribute class to use my entitydatamodel as follows

     private class SimpleMembershipInitializer
        {
            public SimpleMembershipInitializer()
            {
                Database.SetInitializer<UsersContext>(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);
                    WebSecurity.InitializeDatabaseConnection("Entities", "aspnet_Users", "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);
                }
            }
        }
    

When I run my project it comes to SimpleMembershipInitializer class and then

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

How do I solve this?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Roshan
  • 3,236
  • 10
  • 41
  • 63

1 Answers1

0

Duplicate question. This has been asked many times before.

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

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

Using ADO.NET MySQL Provider in MVC3 (Unable to find the requested .Net Framework Data Provider. It may not be installed.)

Community
  • 1
  • 1
Randy
  • 2,270
  • 1
  • 15
  • 24
  • Hi , Randy .. The first link has no correct answer marked. and second link is not for using entityframwork – Roshan Dec 04 '15 at 18:21
  • This particular error is not related to Entity Framework. It's a direct result of ADO.NET not being able to find the right data provider for the database you are trying to connect to. Did you try the solution suggested in the second link? – Randy Dec 04 '15 at 18:25
  • I Have How can i change it.? – Roshan Dec 04 '15 at 18:32
  • Can you provide a copy of your web.config file? More specifically, I'd like to see the invariant name for connection string entry. – Randy Dec 04 '15 at 18:49
  • Randy How could i provide it to you? – Roshan Dec 04 '15 at 18:55
  • You could copy and paste it here. Just remove any sensitive data before do it. – Randy Dec 04 '15 at 18:55
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/97008/discussion-between-randy-and-roshan). – Randy Dec 04 '15 at 18:56