0
我想设置一个简单的示例Couchbase安装程序,通过C#客户端通信,但它给我适合。我已经安装了Couchbase并添加了一个memcached存储桶。这是我与它通信简单的代码:简单Couchbase与C#客户端安装程序失败
public static void MemcachedTest()
{
CouchbaseClient client = new CouchbaseClient(); // failure point!
client.Store(Enyim.Caching.Memcached.StoreMode.Set, "Testing", "Hello world");
var test = client.Get("Testing");
}
这里是我的app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<configSections>
<section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
</configSections>
<couchbase>
<servers bucket="testbucket">
<add uri="http://127.0.0.1"/> // tried lots of different values here.
</servers>
</couchbase>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
的错误是没有内在的异常细节一个空引用异常。栈跟踪是:
at Couchbase.CouchbaseClient..ctor(ICouchbaseClientConfiguration configuration)
at Couchbase.CouchbaseClient..ctor()
at CacheClientTests.Program.MemcachedTest() in C:\Dev\Experiments\CacheClientTests\CacheClientTests\CacheClientTests\Program.cs:line 72
at CacheClientTests.Program.Main(String[] args) in C:\Dev\Experiments\CacheClientTests\CacheClientTests\CacheClientTests\Program.cs:line 79
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
为什么这个简单的配置失败?
包含更多的堆栈跟踪,如果超级大,请将它或东西包含在内。你有没有尝试使用uri作为'http://127.0.0.1:8091/pools'? 这个答案可能是相关看你的问题http://stackoverflow.com/questions/12677445/unable-to-get-enyim-caching-memcachedclient-to-work-with-couchbase?rq=1 – scalabilitysolved
@scalabilitysolved我包括完整的堆栈跟踪,我已经尝试过你提到的uri,但它没有改变任何东西。 – Jim