Unable to initialize provider. Missing or incorrect schema. for MySql.Web connector

一曲冷凌霜 提交于 2019-12-30 18:07:06

问题


Hey guys and gals running into a little issue here.. I'm trying to use MySql Connector 6.2.2.0 for membership and role providers..

The issue I'm having is: Unable to initialize provider. Missing or incorrect schema.

<authentication mode="Forms"/>
<roleManager defaultProvider="MySqlRoleProvider"
    enabled="true"
    cacheRolesInCookie="true"
    cookieName=".ASPROLES"
    cookieTimeout="30"
    cookiePath="/"
    cookieRequireSSL="false"
    cookieSlidingExpiration="true"
    cookieProtection="All" >
  <providers>
    <clear />
    <add
        name="MySqlRoleProvider"
        type="MySql.Web.Security.MySQLRoleProvider, MySql.Web,
        Version=6.2.2.0,Culture=neutral, PublicKeyToken=c5687fc88969c44d"   
        connectionStringName="mySQL"
        applicationName="capcafe"
        writeExceptionsToEventLog="true"
    />
  </providers>
</roleManager>
<membership defaultProvider="MySqlMembershipProvider">
   <providers>
      <add connectionStringName="mySQL" 
         applicationName="capcafe" 
         minRequiredPasswordLength="5"
         requiresQuestionAndAnswer="false" 
         requiresUniqueEmail="false"
         minRequiredNonalphanumericCharacters="0" 
         name="MySqlMembershipProvider"
         type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.2.2.0,
         Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
   </providers>
</membership>

Here is the line it doesn't seem to like:

Line 57:             type="MySql.Web.Security.MySQLRoleProvider, MySql.Web,
Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"

I have both MySql.Web and MySql.Data referenced and in my bin! Any help resolving this issue will be very much appreciated


回答1:


Add references to the assemblies, add autogenerateschema="true" attribute to both as:

<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>

use ASP.Net configuration tool.




回答2:


I had this problem, it turned out there was no password in my connection string, I think checking carefully that your connection string is correct would be a good place to start.




回答3:


My problem was I had "localhost" in my connection string instead of the IP address of the webhost's MySQL server.

Once I changed that in my web.config file it worked fine, so you need to check your web.config file very carefully.




回答4:


I was experiencing this exact same issue. Mine ended up being a case issue since I was deploying my site to a linux server running Mono. Enabling autogenerateschema="true" helped me figure this one out. Some hosts won't let the code generate the necessary tables though, so if it doesn't auto-generate your schema then check out casing issues.




回答5:


CodeMonkey's solution worked for me... I was actually deploying a new app to a Win 2008 Server VM. The schema could not be generated until I specified the LocalMySql connection string and set the MySQLRoleProvider autogenerate to true.



来源:https://stackoverflow.com/questions/2393131/unable-to-initialize-provider-missing-or-incorrect-schema-for-mysql-web-connec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!