views:

322

answers:

1

I'm trying to use the MySQLRoleProvider(MySql.Web, Version=6.2.2.0) with Visual Web Developer 2008.

When trying to add a role I get an exception "Table 'test.my_aspnet_applications' doesn't exist"

if (!Roles.RoleExists("TestRole"))
{
  Roles.CreateRole("TestRole");
}

Can someone tell me where I went wrong. Or tell me how to generate / find the correct database script to create the role, membership, profile ... MySql tables.

    <membership defaultProvider="MySQLMembershipProvider">
        <providers>
            <remove name="MySQLMembershipProvider"/>
            <add autogenerateschema="true" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
        </providers>
    </membership>
    <profile enabled="true" defaultProvider="MySQLProfileProvider">
        <providers>
            <remove name="MySQLProfileProvider"/>
            <add name="MySQLProfileProvider" autogenerateschema="true" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/"/>
        </providers>
    </profile>
    <roleManager enabled="true" defaultProvider="MySQLRoleProvider">
        <providers>
            <remove name="MySQLRoleProvider"/>
            <add autogenerateschema="true" connectionStringName="LocalMySqlServer" applicationName="/" name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
        </providers>
    </roleManager>      
+1  A: 

Have you used the ASP.Net configuration tool to switch your application's provider to the MySQL provider? I believe this is what triggers the MySQL provider to automatically generate the schema.

womp
Yes, done that. Used the ASP.NET web configuration tool and switched from AspNet***Providers to MySQL***Providers. Didn't generate any tables? Can't see / use the MySQL config tool in VWD 2008.
biometrics74
My mistake, I tried the ASP.Net configuration tool again, switching from MySQL***Provider back to AspNet***Providers, then to MySQL***Providers again. This time it generated the tables. I suspect the first time I didn't have the autogenerateschema attribute set.
biometrics74