Configuration error on ASP.NET page with MySQL membership

184 Views Asked by At

I have a website that has been running for years with the same configuration. Suddenly something has changed with our web host that has broken it and we get this error: "Unable to initialize provider. Missing or incorrect schema." pointing to the roleManager section.

We use MySQL as the backend to the membership features in web.config. Here is the current content of web.config that I'm using:

<?xml version="1.0"?>
<configuration>
    <connectionStrings>
        <remove name="ApplicationServices" />
        <add name="ApplicationServices" connectionString="Server=*;Port=*; Database=*; User ID=*; Password=*;CharSet=utf8;" providerName="MySql.Data.MySqlClient" />
    </connectionStrings>
    <system.web>
        <customErrors mode="Off"/>
            <compilation debug="false">
                <assemblies>
                    <add assembly="MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
                    <add assembly="MySql.Web, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
                    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                </assemblies>
            </compilation>

            <membership defaultProvider="AspNetSqlMembershipProvider">
                <providers>
                    <clear />
                    <add name="AspNetSqlMembershipProvider" autogenerateschema="true" writeExceptionsToEventLog="false" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="ApplicationServices" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/" />
                </providers>
            </membership>

            <profile>
                <providers>
                    <clear />
                    <add name="AspNetSqlProfileProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="ApplicationServices" applicationName="/" />
                </providers>
            </profile>

            <roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
                <providers>
                    <clear />
                    <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
                </providers>
            </roleManager>
        </system.web>
        <system.webServer>
            <httpErrors errorMode="Detailed" />
        </system.webServer>
    </configuration>

We are using version 5.7.26 of MySQL server and Microsoft .NET Framework Version:2.0.50727.9054; ASP.NET Version:2.0.50727.9051

Previously we were using version 6.1.3.0 of the MySQL connector without any problems but I noticed that it is not compatible with 5.7 of MySQL servers so I changed it to 6.5.4.0, but it made no difference. I have tried running locally and get the same error.

I have been able to successfully connect to the database from a C# code file with the same connection string so I know that's not the problem. I have tried deleting all of the existing membership tables and using autogenerateschema="true" but the tables are not regenerated. How do I know it is able to reach the database as I get the same error with invalid credentials?

Any ideas what could be going wrong?

0

There are 0 best solutions below