首先得到源代码(这个看其他人的文章好了)
源代码的结构中有一个dottextweb的目录就是web目录了。
在iis中添加一个虚拟目录,比如叫"blog",目录为dottextweb.然后在dottext.sln中修改web project的属性以保证你能打开这个project(如果这样修改了的话 将
project("{fae04ec0-301f-11d3-bf4b-00c04f79efbc}") = "dottextweb", "http://localhost/dottextweb/dottextweb.csproj", "{d5711ab8-be34-4d64-91a2-b68f310ca995}"
projectsection(projectdependencies) = postproject
endprojectsection
projectsection(projectdependencies) = postproject
endprojectsection
endproject
改为
project("{fae04ec0-301f-11d3-bf4b-00c04f79efbc}") = "dottextweb", "http://localhost/blog/dottextweb.csproj", "{d5711ab8-be34-4d64-91a2-b68f310ca995}"
projectsection(projectdependencies) = postproject
endprojectsection
projectsection(projectdependencies) = postproject
endprojectsection
endproject
马上用vs.net打开这个sln,全部重编译一下。(至少工程要能搞顶是吧)
下一步是创建数据库
先自己创建一个数据库。比如说blogdb。然后准备在这个数据库上执行下面的sql脚本
dottext\otherstuff\sql scripts 目录下面有3个sql文件
dottextsetup_*** (后面的是版本号)。这个先执行,用于创建数据库中的表结构
keywords.sql 然后执行这个
dottextsprocs.sql 最后执行这个,创建存储过程。不过现在先不要执行。先看下面的2个bug
***fix bug1***
原作者遗漏了一个触发器没创建(有的版本没创建。。这种开源项目,每天都在更新。。)
执行下面的sql创建这个触发器
set quoted_identifier on
go
set ansi_nulls on
go
create trigger blog_content_trigger
on blog_content
after insert, update, delete
as
declare @blogid int
–get the current blogid
select @blogid = blogid from inserted
–much more likely to be an insert than delete
–need to run on updates as well, incase an item is marked as inactive
if(@blogid is null)
begin
select @blogid = blogid from deleted
end
update blog_config
set
postcount = (select count(*) from blog_content where blog_content.blogid = blog_config.blogid and posttype = 1 and active = 1),
commentcount = (select count(*) from blog_content where blog_content.blogid = blog_config.blogid and posttype = 3 and active = 1),
storycount = (select count(*) from blog_content where blog_content.blogid = blog_config.blogid and posttype = 2 and active = 1),
pingtrackcount = (select count(*) from blog_content where blog_content.blogid = blog_config.blogid and posttype = 4 and active = 1)
where blogid = @blogid
go
set quoted_identifier off
go
set ansi_nulls on
go
***fix bug2***
这个文件中有个叫dnw_getrecentposts存储过程, 把里面and blog_content.id <> 50拿掉, 不然id为50的blogger发的blog永远不会在首页显示出来.
接下来的工作,你要需要确定你是怎么使用这个blog. .text支持3种方式。单用户 物理多用户 和 虚拟多用户
单用户我们肯定是不会使用的。这里首先要谈下物理多用户和虚拟多用户的区别。.text的blog在访问某个人的blog时看起来是这样的
www.ncuhome.com/blog/xxx/ xxx为用户名。
根据一般的经验。在blog目录下必须存在一个xxx的目录或则虚拟目录。用户少的时候,没问题。但是用户一多就麻烦了。于是需要通过设置iis来达到将访问控制全部交给.net的目的
选择站点的属性——> home directory –> config ,add 一个后缀名为*的处理方式(连文件夹都包含过去了),设置处理的isapi为
"p:\windows\microsoft.net\framework\v1.1.4322\aspnet_isapi.dll"
在2003下则只要insert这个isapi就可以了。(我在xp专业版上加不了..痛苦)
当然不要忘记在iis中添加默认页面default.aspx
这些都完成后就可以添加一个用户测试了,执行下面在readme中带的sql
insert into [blog_config]
(
[username], [password], [email], [title], [subtitle],
[skin], [host], [author], [timezone],
[isactive], [language], [itemcount], [allowserviceaccess], [lastupdated],
[news], [secondarycss],
[application]
)
values
(
aliy, aliy, joy@joycode.com,aliy, aliys blog,
marvin3-red, blog.joycode.com,aliy,0,
1,zh-chs, 15, 1,7/28/2003, null, null,
aliy
)
需要注意的是host字段。必须与在浏览器中输入的完全相同。比如你有个站点的host是ncuhome.com,ip是210.35.247.34
那么当你使用http://ncuhome.com/blog/waterflier/ 可以访问到用户waterflier的blog,但是使用http://210.35.247.34/blog/waterflier/就访问不到了。这点就要特别注意了。
