2

我已经安装了 couchbase 1.8 并使用了 couchbase .net 客户端库。是否按照以下文档中给出的所有配置,但 client.store 总是失败并返回 false。


<configSections>
<section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
</configSections>
<couchbase>
<servers bucket="default" bucketPassword="">
<add uri="http://xx.xx.xx.xx:8091/pools/default"/>
</servers>
</couchbase>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

CouchbaseClient client = new CouchbaseClient(); //this creates a not null client object
bool result = client.store(Storemode.Add,"test","Couchbase test"); // this returns false always
string str = client.Get("test") as string; // this returns null always

我可以远程登录到 8091 端口。telnet 进入一个空白屏幕,键入任何来自 telnet 会话的键,说客户端发送了一个错误的请求。我猜这是正确的行为,但不知何故商店失败了。我在 couchbase 默认数据桶上看不到任何活动。

任何帮助表示赞赏。

4

3 回答 3

0

您的配置看起来正确。但是,如果您之前为键“test”保存了一个非字符串值,那么您的代码将为结果生成 false,为字符串生成 null。

对于给定键的存储操作,StoreMode.Add 将只工作一次。因此,如果您之前为键“test”保存了一个 int,那么 Store 将失败。as cast 也将返回 null。

如果您尝试使用 StoreMode.Set,代码是否运行正常?

于 2012-04-16T01:37:26.070 回答
0

我有同样的问题。

安装 Couchbase Server 后,在配置网站的 Server Nodes 选项卡上,您应该会看到服务器的 IP。

该 IP 可能是错误的(因为它是由安装程序随机分配的)。

如果它是错误的(例如不是公共 IP),请按照以下步骤设置正确的 IP。还要确保您已关闭防火墙,或者您已畅通端口。

于 2013-03-08T11:26:50.400 回答
0

另一个可能导致此错误的问题是开发环境中的防火墙阻止了此错误。您可以通过绕过 IE 中的 couchbase ip 服务器来解决此问题:工具/Internet 选项/连接/LAN 设置/高级/例外。

问候。

于 2014-08-25T02:57:27.730 回答