【IT168 技术文档】 最近在把一个基于.net 2.0 下的Community Server 2.0 的站点升级到基于.net 2.0 下的Community Server 2.1的时候,碰到了一些小问题,
特整理如下:
一、Community Server 2.1 中,基于.net 2.0 和 .net 1.1 的两个配置文件结构不一样的。
这两个配置文件如下:
Web.config
communityserver.config
而,我们从CommunityServer站点下载到的SDK源代码是基于1.1的,2.0下的文件需要我们自己来修改。
基于.net 1.1 的 Web.config 文件,与基于.net 2.0 的文件,有以下配置节是不一样的,
这些不一样的地方,都是.net 2.0 中新提供的一些功能,如下:
Community Server 2.1 中使用了.net2.0中才有的一些配置节,这些配置节如下:
1、数据库链接配置节 connectionStrings
2、Page.EnableEventValidation 配置属性
3、machineKey 配置节
4、membership 配置节
5、roleManager 配置节
6、profile 配置节
7、anonymousIdentification 配置节
基于.net 1.1 的 communityserver.config 和 基于.net 2.0 的差别主要是一些实现上的不同:
如下,首先是 .net 2.0 下的配置
<add
name = "MemberRoleProfileProvider"
type = "CommunityServer.ASPNet20MemberRole.CSMemberRoleProfileProvider,CommunityServer.ASPNet20MemberRole"
/><job singleThread = "false" minutes = "5" name = "Emails" type =
"CommunityServer.Components.AspNet20EmailJob, CommunityServer.Components" enabled
= "true" enableShutDown = "false"failureInterval = "1" numberOfTries = "10" />
其下是 .net 1.1 下的配置
<add
name = "MemberRoleProfileProvider"
type = "CommunityServer.MemberRole.CSMemberRoleProfileProvider,CommunityServer.MemberRole"
/><job singleThread = "false" minutes = "5" name = "Emails" type =
"CommunityServer.Components.EmailJob, CommunityServer.Components" enabled = "true"
enableShutDown = "false" failureInterval ="1" numberOfTries = "10" />
二、数据库链接字符串的问题。
如果你是XP的电脑,IIS5.1 下,执行Web应用的帐号是ASPNET帐号。
如果你使用Window认证方式,
连接字符串类似如下:
Server=.\SQLEXPRESS; Integrated Security=True; Database=CS2.1; Persist Security Info=True;
注意,这时候,要根据你的Web环境不同,给对应帐号对数据库有权限:
三、数据库的升级
按照Community Server 的文档,如果你已经之前把Community Server 2.0 运行在.net 2.0 下,只需要执行 cs_2.x_to_2.1_upgrade.sql
但是,我发现,如果我执行这么一步的话,会报错误:
参数错误
异常详细信息: System.Data.SqlClient.SqlException: Procedure or Function 'aspnet_Profile_GetProperties' expects parameter
'@TimeZoneAdjustment', which was not supplied.
所以你一定要执行下面两步:
1. Execute: cs_2.x_to_2.1_upgrade.sql
2、Execute cs_ASPNET2_Membership_Schema_Update.sql