日期:2014-05-18  浏览次数:20474 次

高分求救:MemberShip Profile问题
错误提示:
“System.Web.Profile.SqlProfileProvider”要求一个与架构版本“1”兼容的数据库架构。但是,当前的数据库架构与此版本不兼容。您可能需要使用   aspnet_regsql.exe   (在   framework   安装目录中提供)安装一个兼容的架构,或者将提供程序升级到一个较新的版本。


我的环境是:Windows2003   +   VS2005+SQL2005
已经执行   aspnet_regsql.exe   -E   -S   localhost   -A   m     建立了aspnetdb数据库

错误是出现在:
  ProfileCommon   p   =   (ProfileCommon)ProfileCommon.Create(newuser.UserName,   true);
                        p.QQ   =   QQ.Text.Trim();
                        p.MSN   =   MSN.Text.Trim();
                        p.Save();

烦请各位大侠救救小弟!!!!


------解决方案--------------------
没有遇到

aspnet_regsql -S .\SQLExpress -E -A mpr
试试(-A mpr 添加相关支持,为:m: membership,p: profiles, r: roles)

再结合http://msdn2.microsoft.com/zh-cn/library/system.web.profile.sqlprofileprovider(VS.80).aspx看能否找到解决方案
------解决方案--------------------
一套 角色 系统的 数据库 是相当 容易 构建的.
不知道 为什么 现在 那么多人非的 去用MemberShip 这样的东西

难道都是 只在做小项目.

连微软自己都不用.....
------解决方案--------------------
按照shadow841112(孤风) 的设置就能把profile表安装上,你的错误可能就是因为没有安装profile表。profile还需要设置webconfig
<profile enabled= "true ">
<providers>
<clear/>

<add name= "AspNetSqlProfileProvider " connectionStringName= "SqlServer " applicationName= "/ " type= "System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " />

</providers>
<properties>
<group name= "Address ">
<add name= "City " allowAnonymous= "false "/>
<add name= "PostalCode " allowAnonymous= "false "/>
</group>
</properties>

</profile>

properties中间是你自己设置的profile属性

然后在代码中像用session类似的用法