ASP.NET DB错误(由生成脚本引起) [英] ASP.NET DB error (caused by generating a script)
问题描述
我正在使用MS SQL Server 2008 R2
我为我的ASP.NET数据库生成了一个脚本,现在当我尝试使用数据库时,它会出错:
'System.Web.Security.SqlMembershipProvider'需要与架构版本'1'兼容的数据库架构。但是,当前数据库架构与此版本不兼容。您可能需要使用aspnet_regsql.exe(在框架安装目录中提供)安装兼容模式,或者将提供程序升级到更新版本。
我有哪些选项?真的要解决这个问题吗?
我需要运行 aspnet_regsql.exe
还是有办法除了必须使用此选项,因为错误建议绕过此错误?
我的web.config文件如下所示:
< pre lang =HTML> < 编译 debug = true < span class =code-attribute> targetframework = 4.0 >
< 程序集 >
< < span class =code-leadattribute> 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 / >
< span class =code-keyword>< add assembly = System.Web.Extensions.Design,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31BF3856AD364E35 / >
< / assemblies >
< / compilation >
< 成员资格 < span class =code-attribute> defaultprovider = SqlProvider >
< 提供商 >
< clear / >
< 添加 名称 = SqlProvider >
type =System.Web.Security.SqlMembershipProvider
connectionStringName =CPMS_DB
enablePasswordRetrieval =false
enablePasswordReset =true
requiresQuestionAndAnswer =true
requiresUniqueEmail =false
maxInvalidPasswordAttempts = 3
minRequiredPasswordLength =6
minRequire dNonalphanumericCharacters =0
passwordAttemptWindow =3
applicationName =//>
< / add > < / providers >
< / membership >
< 个人资料 >
< 提供商 >
< clear / >
< add name = AspNetSqlProfileProvider >
type =System.Web.Profile.SqlProfileProvider
connectionStringName =ApplicationServices
applicationName =//>
< / add > < / providers >
< / profile >
< rolemanager 已启用 = true >
< 提供商 < span class =code-keyword>>
< clear / >
< add connectionstringname = ApplicationServices >
applicationName =/
name =AspNetSqlRoleProvider
type =System.Web.Security.SqlRoleProvider/ >
< add < span class =code-attribute> applicationname = / >
name =AspNetWindowsTokenRoleProvider
type =System.Web.Security.WindowsTokenRoleProvider/>
< / add > < / add > < / providers >
< / rolemanager >
请帮助....谢谢
我复制了从表aspnet_Applications中我的旧数据库(我已经为其生成了脚本)并将它们粘贴到新脚本生成的数据库中,将应用程序ID粘贴到需要applicationId的所有其他相关表中。
也用表aspnet_SchemaVersions做同样的事情
现在它完美无缺
快乐编码...... ......
您可以查看以下链接以获取解决方案。请尝试它虽然听起来很狡猾:)
http://stackoverflow.com/questions/3292794/the-system-web-security-sqlmembershipprovider-requires-a-database-schema-compa [< a href =http://stackoverflow.com/questions/3292794/the-system-web-security-sqlmembershipprovider-requires-a-database-schema-compatarget =_ blanktitle =New Window> ^ ]
希望这会有所帮助......
I am using MS SQL Server 2008 R2
I generated a script for my ASP.NET 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="/"/>
</add></providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider">
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="ApplicationServices"
applicationName="/"/>
</add></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" />
</add></add></providers>
</rolemanager>
Please help.... Thank you
I copied the values from the my old DB (the 1 I had generated the script for) from table "aspnet_Applications" and pasted them on the new script generated database, the the application ID into all the other related tables that need the applicationId.
Also did the same with table "aspnet_SchemaVersions"
Now it works perfectly
Happy coding.........
You can check the below link for a solution . Please try it though it sounds sily :)
http://stackoverflow.com/questions/3292794/the-system-web-security-sqlmembershipprovider-requires-a-database-schema-compa[^]
Hope this helps...
这篇关于ASP.NET DB错误(由生成脚本引起)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!