现在的位置: 首页 > 综合 > 正文

安装CommunityServer2.1过程中的错误

2013年05月13日 ⁄ 综合 ⁄ 共 3311字 ⁄ 字号 评论关闭

打算了解一下CommunityServer,所以今天去下载了一个2.1版本的。但是命途多舛啊!过程中出现了好些错误。

执行SQL过程中遇到的问题

在这个过程中,按照SqlScripts/HOW_TO_SETUP_DATABASE.txt中的说法一步步走,结果刚迈出第一步就出错了!错误提示为:

Error

Cannot grant, deny, or revoke permissions to sa, dbo, information_schema, sys, or yourself.

这个错误从网上寻了下,在蝈蝈俊.NET处见到了说明:

蝈蝈俊.NET

我们察看其中的安装 SQL 脚本,是如下的 SQL 导致错误发生的:

declare @command nvarchar(4000) set @command = 'grant execute on [dbo].aspnet_RegisterSchemaVersion to '_
+ QUOTENAME(user) exec (@command)

这行代码,看逻辑,应该是 自己把权限分配给自己。
这么写在 sql 2000 下没有问题,在 sql 2005 下就出错了。
不过一般这个错误可以忽略不计。因为不影响我们其他的逻辑。

由于本身水平有限,也就跟着忽略吧。

在蝈蝈俊还提到了2.0中会出现的错误,由于我安装的是2.1,没有这个问题,不过也顺便记录下:

蝈蝈俊.NET

另外,如果你在运行基于 sql 2005 数据库的 Community Server 2.0 站点,运行时候如果发现有些存储过程由执行权限的错误报告,可以执行如下sql脚本修复这个已知的BUG。 据说这个 BUG 要在  Community Server 2.1 中才修复。

grant execute on dbo.cs_BlogActivityReportAggregate_Get to public grant execute on dbo.cs_UserActivityReportRecords_Get to public grant execute on dbo.cs_Content_GetList to public grant execute on dbo.cs_PostAttachment_Delete to public grant execute on dbo.files_Entries_GetEntries to public grant execute on dbo.cs_PostAttachment_ToggleTemporary to public grant execute on dbo.cs_PostAttachment_Add to public

试运行

配置好web.config,然后在IIS中配置好虚拟目录后,在地址栏敲入http://localhost/cs,怀着心仪的心情等了许久,等出的竟是一个错误:

Error

在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)

以前曾遇到过这个问题,但是当时查出是SQL Server2005的远程连接为开通,这个居然又碰到了,不过可以排除是远程连接的问题,那么是连接字段的问题?我明明修改过web.config中的连接字符串了啊!不过,搜索的结果告诉我这个错误多半就是连接字符串引起的。于是看看设置,也便看出了问题:

<connectionStrings>
    
<add name="SiteSqlServer" connectionString="server=.\SQLEXPRESS;uid=cs;pwd=123456;database=CommunityServer" />
</connectionStrings> 

<appSettings>
    
<add key="SiteSqlServer" value="server=(local);uid=cs;pwd=123456;database=CommunityServer" />
    
<add key="SiteSqlServerOwner" value="dbo" />
</appSettings>

发现在<appSettings>中的key="SiteSqlServer"中,我忘了修改它的server值了,于是将server=(local)改为server=.\SQLEXPRESS。这下OK了吧?我想……

点刷新,等待,结果——又是个错误!

Error

                           Critical Error: Data Store Unavailable

The data store used by Community Server cannot be opened.

Please ensure that your database is online and running and that the connection string in your web.config file is correct

关键错误-数据存储无效?!然后在这个错误后面跟了些指导性意见:

Tips

To configure your connection string:
1. Open [Install Location of Community Server]\web\web.config

2. Within web.config find the configuration section (highlighted) below:

<configuration>
  <appSettings>
<add key="SiteSqlServer" value="[Your connection string here]" >
  </appSettings>
</configuration>

3. Modify the value to properly identify your database.

For example, to connect to a database named CommunityServer on the current machine with an account csSystem and the password pa$$word12:

  connectionString = "server=.;database=CommunityServer;
                                       uid=csSystem;pwd=pa$$word12"

但是,这个key="SiteSqlServer"我可是刚改过的啊,不会还有错误吧!搜索了下,多数还是介绍说检查下连接字符串的正确性。不过看到了很重要的一条:

Tips

如果你使用基于数据库帐号的非信任连接方式,只需确保web.config中的connectionstring正确。
如果你使用信任连接方式,则必须先在SQL Server中为连接数据库的登陆名赋予数据库的db_owner角色,同时确保web.config中的connectionstring正确。

好,在Microsoft SQL Server Management Studio中为cs赋予了db_owner,原先仅有db_datareader、db_datawriter、db_ddladmin、db_securityadmin以及public。因为在SqlScripts/HOW_TO_SETUP_DATABASE.txt中有这么一段:

Tips

- Note: At a minimum, Community Server will required the following database roles:
db_securityadmin
db_ddladmin
db_datareader
db_datawriter

但是按minimum的配置,就会出现这个错误,而再加个db_owner,就没问题了。

啊!终于成功了!看看效果吧。

 

如果您碰到类似错误,希望本篇能够起到参考作用。

本Blog中所有内容皆以“现状”提供且没有任何担保,同时也没有授予任何权利。
This posting is provided "AS IS" with no warranties, and confers no rights.

抱歉!评论已关闭.