Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2009, 03:47 AM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default Configuration error when trying to run .NET Membership with MySQL Connector

Not sure if any of you are programming against a MySQL database, but I'm trying to configure the .NET Membership and Roles provider. At this point I've spent about 24 hours hacking different options. I'm frustrated and stumped. Regardless of what I try, when I click the Security tab in the ASP.NET Website configuration tool, I receive this message.

unable to initialize provider. missing or incorrect schema.

When I go to the Providers tab, the MySQL Membership and Role providers are options, however you cannot test them, which makes me think the config tool can't talk to it.

However, this is bizarre, because I've been using this connection string's name in a .NET application that displays data from the MySQL database to the webpages, so clearly the connection string, the connector, the database, and everything else are functioning fine.

Here's the important parts of my web.config, can anyone see what I'm missing??


Code:
<?xml version="1.0"?> 
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">; 
 
    <connectionStrings> 
<add name="MysqlSchemaConnectionString" connectionString="server=localhost; user id=AspNet; password=mysqlrgrn333rwn; database=lisakristin; pooling=false;" 
   providerName="MySql.Data.MySqlClient"/> 
    </connectionStrings> 
 
    <system.web> 
 
 
        <authentication mode="Forms"> 
            <forms cookieless="AutoDetect" loginUrl="~/ECBeta/Error404.aspx" /> 
        </authentication> 
 
        <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx"> 
            <error statusCode="404" redirect="Error404.aspx" /> 
        </customErrors> 
 
 
 
    <membership defaultProvider="MySQLMembershipProvider"> 
        <providers> 
            <add name="MySQLMembershipProvider"  
            autogenerateschema="true"  
            connectionStringName="MysqlSchemaConnectionString" 
type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.1.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" 
            enablePasswordRetrieval="false" enablePasswordReset="true" 
            requiresQuestionAndAnswer="true" 
            applicationName="/" 
            requiresUniqueEmail="false" 
            passwordFormat="Clear" 
            maxInvalidPasswordAttempts="5" 
            minRequiredPasswordLength="7" 
            minRequiredNonalphanumericCharacters="1" 
            passwordAttemptWindow="10" 
            passwordStrengthRegularExpression="" /> 
        </providers> 
    </membership> 
 
    <profile enabled="true" defaultProvider="AccessProfileProvider"> 
        <providers> 
            <add name="MySQLProfileProvider"  
            autogenerateschema="true" 
            connectionStringName="MysqlSchemaConnectionString"  
            type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.1.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"  
            applicationName="/" /> 
        </providers> 
        <properties> 
            <add name="FriendlyName" type="string" allowAnonymous="false" serializeAs="String"/> 
            <add name="Height" type="int" allowAnonymous="false" serializeAs="String"/> 
            <add name="Weight" type="int" allowAnonymous="false" serializeAs="Xml"/> 
        </properties> 
    </profile> 
 
 
    <roleManager enabled="true" defaultProvider="MySQLRoleProvider"> 
        <providers> 
            <add name="MySQLRoleProvider" 
            autogenerateschema="true" 
            connectionStringName="MysqlSchemaConnectionString" 
            type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.1.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" 
            applicationName="/" /> 
        </providers> 
    </roleManager> 
 
    </system.web> 
</configuration>
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old November 28th, 2009, 05:27 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I think this error:

unable to initialize provider. missing or incorrect schema.

means it can connect to the database, but that it cannot find the correct data in some tables. When you install membership and other services on SQL Server, the aspnet_SchemaVersions table contains a few records such as

Code:
 
Feature            CompatibleSchemaVersion    IsCurrentVersion
common             1                          True
membership         1                          True
role manager       1                          True
I don't know how to fix this the right way on a MySql installation (I doubt the aspnet_regsql tool works with MySql) but it's worth trying to add these records manually to the table and see if that helps.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; November 28th, 2009 at 05:29 AM..
 
Old November 29th, 2009, 03:57 AM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Interesting, are those the only records in that database table? I don't even have an aspnet_SchemaVersions table in the MySQL database. Therefore, I created one and added the three records you mentioned manually, but I'm still getting the same error.

Is aspnet_SchemaVersions something that is constructed by the providers? I have the autogenerateschema="true" attribute listed in all three items, the membership, profile, and roles providers. I was hoping the providers would construct those for me as advertised; I'm sure it's a more reliable way of making sure everything is configured the right way. I do have an old Access version that you'd help me set up several years ago for one of my friend's websites, so I could try copying all those records over to MySQL.

Also, the application won't compile now. I've no idea what could have changed between last night when only the ASP.NET Website config tool was throwing the erro and this morning when compiling the app throws the error. If it means anything it still generates the error when it hits this line in the web.config...

Code:
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.1.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
Thanks for any assistance you can provide. I owe you. :)
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old November 29th, 2009, 06:35 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The table is specific to the SQL Server providers; they are not required by the underlying provder model. That is, you could write an XML provider, or a Microsoft Access provider as you used earlier that stick to the provider model contract, without using a table like that.

AFAIK, this table is used for possible future upgrades of the SQL Server providers where multiple schemas can coexist in the same database.

I am sorry I can't help much more; never used My SQLfor membership. Google brings up a number of interesting articles for "unable to initialize provider. missing or incorrect schema' but I am sure you already looked at those.... ;-)

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
chroniclemaster1 (November 29th, 2009)
 
Old November 29th, 2009, 12:28 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

OK, that's what I assumed; I haven't "studied" my .mdb extensively, but I didn't recognize the table name you mentioned. *sigh*

Yes, I followed MySQL's official .NET Connector documentation on setting up the provider model, but it doesn't talk about errors. There are a number of posts at the MySQL forum as well as the Google articles. I've already tried changing the web.config to check the different variations the articles suggest, so if I go any further with them, it will mean lining up a stack of procedures and just trying each of them until I find one that makes the "magic" happen. I was hoping for something a little more scientific that would help me learn more about .NET at the same time, but if Magic is the only way to get it up and running, so be it. ;)

Who knows, I've also posted on the MySQL's forums so hopefully someone there can help me.

Imar, I do really appreciate all your help. I appreciate being able to borrow your expertise and at least find the most likely avenue of attack to solve the problem. If you have any other advice, it's always appreciated. You rock. :)
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old November 29th, 2009, 12:53 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I am not sure we discussed this ealier when you implemented the Access version but did you know Microsoft released the full source code the SQL Server application services?

http://weblogs.asp.net/scottgu/archi...13/442772.aspx

This won't help you fix the MySQL issues, but it will certainly help you understand the magic behind the provider model.

Is the MySQL implementation open source? Maybe you can search for locations in the code that throw the error you're geting and see if that sheds some light?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!




Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Connector Error rturner003 BOOK: Professional Crystal Reports for VS.NET 0 October 30th, 2007 04:49 AM
need help in testing and configuration of mysql nofences84 MySQL 2 January 5th, 2007 01:04 PM
about php and mysql configuration spbharti BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 April 23rd, 2006 08:25 AM
MYSQL Configuration randbert96310 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 9 June 24th, 2004 07:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.