'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'

本秂侑毒 提交于 2019-12-11 10:38:24

问题


I want to use profiles and was able to use aspent_regsql -A p to install the tables. I can see them throughout SQL management studio.

I'm actually using SQLExpress 2005, and my dbo.aspnet_SchemaVersions is populated. Does anybody know what could be going wrong?

By the way, I'm pretty sure my connection string and app code are all right. Thanks in advance.

<system.web>
<membership>

  <providers>

    <remove name="AspNetSqlMembershipProvider" />

    <add name="AspNetSqlMembershipProvider"

      type="System.Web.Security.SqlMembershipProvider,

       System.Web, Version=2.0.0.0, Culture=neutral,                                

       PublicKeyToken=b03f5f7f11d50a3a"

      connectionStringName="RGConnectionString" />

  </providers>

</membership>
<profile>
  <providers>
    <add name="ProfileProvider" type="System.Web.Security.SqlProfileProvider,

       System.Web, Version=2.0.0.0, Culture=neutral,                                

       PublicKeyToken=b03f5f7f11d50a3a"

      connectionStringName="RGConnectionString"/>
  </providers>

回答1:


Well, fool of me. I was quite sure it was a problem with SQLExpress database but it was actually my web.config file that was totally weird. I got it to work by adding the correct properties to the providers:

  <connectionStrings>
    <add name="RGConnectionString"
         connectionString="Data Source=(local)\SQLExpress;Initial Catalog=aspnetdb;Integrated Security=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>

    <membership>
      <providers>
        <remove name="AspNetSqlMembershipProvider" />
        <add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
             connectionStringName="RGConnectionString" 
             enablePasswordRetrieval="true"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="true"
             requiresUniqueEmail="true"
             passwordFormat="Clear"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="8"
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10"
             passwordStrengthRegularExpression="" 
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <add name="ProfileProvider"
             type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
             connectionStringName="RGConnectionString"
             applicationName="/" />
      </providers>
    </profile>

  </system.web>



回答2:


This may happen if you script your database and not populate [aspnet_SchemaVersions] table. This table holds information about membership table schema. If this table empty, you will see error about membership version.



来源:https://stackoverflow.com/questions/652980/system-web-security-sqlmembershipprovider-requires-a-database-schema-compatibl

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