.Text blog的一点点安装心得

80酷酷网    80kuku.com

  心得首先得到源代码(这个看其他人的文章好了)
源代码的结构中有一个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', 'joyjoycode.com','Aliy', 'Aliy's 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/就访问不到了。这点就要特别注意了。



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: