简体   繁体   中英

SqlMembershipProvider not compatible with this version

I generated a script for my aspnet Database, now when I try to use the database it gives an error

The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'. However, the current database schema is not compatible with this version. You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.

What options do I really have to solve this problem? Do I need to run aspnet_regsql.exe or is there a way to get around this error besides having to go with this option as the error suggests?

My web.config file looks like this:

<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  </assemblies>
</compilation>

<membership defaultProvider="SqlProvider">
  <providers>
    <clear/>
    <add name="SqlProvider"
         type="System.Web.Security.SqlMembershipProvider"
         connectionStringName="CPMS_DB"
         enablePasswordRetrieval="false"
         enablePasswordReset="true"
         requiresQuestionAndAnswer="true"
         requiresUniqueEmail="false"
         maxInvalidPasswordAttempts="3"
         minRequiredPasswordLength="6"
         minRequiredNonalphanumericCharacters="0"
         passwordAttemptWindow="3"
         applicationName="/"/>
  </providers>
</membership>
<profile>
  <providers>
    <clear/>
    <add name="AspNetSqlProfileProvider"
         type="System.Web.Profile.SqlProfileProvider"
         connectionStringName="ApplicationServices"
         applicationName="/"/>
  </providers>
</profile>
<roleManager enabled="true">
  <providers>
    <clear />
    <add connectionStringName="ApplicationServices" 
         applicationName="/"
      name="AspNetSqlRoleProvider" 
         type="System.Web.Security.SqlRoleProvider" />
    <add applicationName="/" 
         name="AspNetWindowsTokenRoleProvider"
      type="System.Web.Security.WindowsTokenRoleProvider" />
  </providers>
</roleManager>

I would use the aspnet_regsql.exe to create a new/blank database.

Then you could use this:

http://granadacoder.wordpress.com/2007/11/29/membershipprovider-helper-to-transfer-data/

It will "create tsql code" so you can move all your data into your blank database.

I had similar error, 'simple' solutions like closing the project and re-opening, rebuilding, resolves the error. that's if you're sure you did everything correctly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM