programing

'시스템'입니다.웹. 보안.SqlMembershipProvider'에는 스키마 버전 '1'과(와) 호환되는 데이터베이스 스키마가 필요합니다.

i4 2023. 7. 10. 22:01
반응형

'시스템'입니다.웹. 보안.SqlMembershipProvider'에는 스키마 버전 '1'과(와) 호환되는 데이터베이스 스키마가 필요합니다.

SQL Server 2008 DB에는 많은 테이블이 데이터로 채워져 있으며 SQL Server Management Studio를 사용하여 선택한 데이터베이스의 Script Wizard : Tasks -> Generate Scripts -> Script All 개체를 사용하고 Script Data 옵션도 선택하여 SQL 덤프를 생성했습니다.나는 "서버 버전용 스크립트"의 값을 "SQL Server 2008"로 확실히 변경했습니다.그런 다음 새 DB를 만들고 새 DB에서 SQL 덤프를 실행하여 이전 DB의 동일한 복사본을 생성했습니다.그런 다음 기본 사용자에게 권한을 새 DB에 할당했습니다.그런 다음 ASP.NET 응용프로그램에서 새 DB를 사용하도록 연결 문자열을 변경했습니다.하지만 제가 실행해보면 다음과 같은 예외가 발생합니다.

            Server Error in '/myapp' Application.
            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.
            Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

            Exception Details: System.Configuration.Provider.ProviderException: 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.

            Source Error:

            An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

            Stack Trace:

            [ProviderException: 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.]
               System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +1977772
               System.Web.Security.SqlMembershipProvider.CheckSchemaVersion(SqlConnection connection) +89
               System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +815
               System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
               System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
               System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +78
               System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
               System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +119
               System.Web.UI.WebControls.Login.AttemptLogin() +115
               System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
               System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
               System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
               System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
               System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
               System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
               System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
               System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

매우 간단한 방법을 찾았습니다. 이 데이터를 다음에 붙여넣습니다.aspnet_SchemaVersions

common              1   True
health monitoring   1   True
membership          1   True
personalization     1   True
profile             1   True
role manager        1   True

몇 개의 공간을 사용하여 데이터를 정렬하고 공백을 무시해야 했습니다.

아무것도 잊지 않았다면(뷰, SP 등), 구글링은 프로젝트를 닫고 다시 열거나 재구축 또는 다음과 같은 '멍청한' 솔루션을 의미합니다.

실제로 성공한 것은 ASP.NET 구성 유틸리티(Visual Studio - 웹 사이트 메뉴 아래)를 통해 응용 프로그램을 오프라인으로 전환한 다음 다시 온라인으로 전환하는 것이었습니다.이것은 실제로 web.config로 변경합니다(변경 내용이 정확히 무엇인지는 확실하지 않습니다).그래서 오프라인으로 전환한 후 web.config를 호스트 솔루션에 업로드해야 했습니다.그런 다음 응용 프로그램을 다시 온라인으로 가져갔고, 다시 복사한 web.config 등이 있습니다.

정답일 수도 있습니다.

비슷한 문제가 있었는데 aspnet_SchemaVersions 테이블에 기본값을 추가하여 해결할 수 있었습니다.이 기본값은 작업 -> 스크립트 생성을 사용하여 생성된 DB에 추가되지 않았습니다.

여기 유용한 게시물입니다.

INSERT INTO dbo.aspnet_SchemaVersions 
VALUES
('common', 1, 1),
('membership', 1, 1),
('role manager', 1, 1);
GO

앱 풀을 다시 시작하는 것이 효과가 있었습니다.

저는 SQL이나 ASP.net 의 구루나 프로그래머가 아닙니다. 우연히 그 직업을 얻었지만, 같은 문제가 있었고 실수는 어리석었습니다.

내 안에서Web.Conf연결 문자열은 일반적으로 다음과 같습니다.

<add name="AgriConnectionString" connectionString="Data Source=.\SQLEXPRESS; Initial Catalog=AgriBranch; pooling=true; Connection Timeout=120; Integrated Security=false;Persist Security Info=True; User ID=UserID; Password=PASS***WORD" providerName="System.Data.SqlClient" />

제 가 이렇게 ."Data Source=./SQLEXPRESS".

그리고 저는 논의된 것과 같은 오류를 얻었습니다.

이 오류는 또한 Visual Studio의 유틸리티를 사용하여 사이트를 오프라인으로 전환하거나 다시 컴파일할 때 오류가 해결되는 이유를 설명합니다.

웹 구성 파일을 올바른 버전의 시스템으로 업데이트해 보십시오.웹. 보안.Sql 역할 공급자

아래 구성은 c:/windows/microsoft.net/framework/v4.0.30319 또는 다른 버전에서 찾을 수 있으며 구성 파일을 찾을 수 있습니다.버전 및 공개 키를 가져올 시스템 구성 파일을 확인합니다.

.net 프레임 워크 4.0의 경우

     <roleManager enabled="true" defaultProvider="SqlProvider">
     <providers>
        <clear/>
        <add name="SqlProvider" connectionStringName="rolesDB" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
     </providers>
  </roleManager>

.net 프레임워크 2.0용

    <roleManager enabled="true" defaultProvider="SqlProvider">
     <providers>
        <clear/>
        <add name="SqlProvider" connectionStringName="rolesDB" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
     </providers>
  </roleManager>

스키마 값을 채우려면 aspnet_regsql.exe를 실행해야 할 수도 있습니다.생성된 모든 개체(테이블, 뷰, 저장 프로시저 등)가 있는 한 값을 하드 코딩할 수 있습니다.

이 문제를 해결하기 위해 취한 조치는 다음과 같습니다.

aspnet_regsql.exe를 다시 실행하면 IIS가 다시 시작되는 기본값이 보장됩니다.

그리고는 효과가 있었습니다.

그러나 값 없이 데이터베이스 스키마만 복사하는 경우 기본값을 채우려면 'aspnet_regsql.exe'를 실행해야 합니다.

파일은 다음 위치에서 찾을 수 있습니다(대상: msdn).[드라이브:]\%windir%\마이크로소프트.NET\Framework\version(2.0dir 단위)

그리고 여기 몇 가지 정보가 있습니다.
http://msdn..com/en-us/library/ms229862%28v=vs.80%29.aspxhttp ://msdn.microsoft.com/en-us/library/ms229862%28v=vs.80%29.aspx

저의 경우, 위의 해결책 중 어느 것도 효과가 없었습니다.

visual studio에서 만든 webconfig의 memnership provider에서 applicationName="/"을 제거한 다음 서버에 업로드했습니다.

또는 aspnet_Applications 테이블에 응용 프로그램 행을 수동으로 생성할 수 있습니다.

코딩 잘하세요!

위의 여러 옵션을 시도해 보았지만, 그 중 어느 것도 문제를 해결하지 못한 것 같습니다(도움이 되었을 수도 있고 깨닫지 못했지만).

마지막으로 수행한 작업은 연결 문자열의 SQL 사용자에게 aspnet_regsql.exe에 의해 설치된 aspnet_* 역할에 대한 액세스 권한을 부여하는 것이었습니다.내 SQL 사용자가 데이터베이스에서 db_owner로 설정되었지만 상자에 sysadmin이 아니었습니다. 그것이 중요한지는 잘 모르겠습니다.

의 옵션 중 일부를 이미 사용해 본 후에는 모든 것이 잘 작동했습니다.

새 DB에서 aspreg_sql을 실행하는 것을 잊어버린 후 처음 이 오류를 받았습니다.일단 완료되면 Cassini 또는 ASP.NET 개발 서버를 종료할 때까지 이 오류가 발생했습니다.다시 실행하면 잘 작동합니다.

이는 기본적으로 전체 웹 사이트 솔루션을 복사/통과할 때 발생합니다. SQL 서버에 대한 ASP.NET 구성은 별도로 구성해야 합니다.즉, Visual Studio 명령 프롬프트에서 aspnet_regsql을 실행하고 마법사를 실행하는 동안 지침을 따라야 합니다.

오래된 게시물이지만 다른 해결책이 있었습니다.

내 연결 문자열이web.config포함된Persist Security Info=True;그들 안에.이것을 제거하면 오류가 해결됩니다.

언급URL : https://stackoverflow.com/questions/3292794/the-system-web-security-sqlmembershipprovider-requires-a-database-schema-compa

반응형