.NET SDK + Hammock

Hello,

I would like to use Hammock inside the .NET SDK, and I find a ‘HammockHttpClient.cs’ in the ‘Couchbase.HttpClient’ project. How should I use this HammockHttpClient.cs file in my project?

I tried to add ‘’ to App.config. However I got the following error:

‘The value of the property ‘type’ cannot be parsed. The error is: The type ‘Couchbase.HammockHttpClientFactory, Couchbase’ cannot be resolved…’

From this post (http://www.couchbase.com/issues/browse/NCBC-271), it seems that couchbase removed Hammock from its SDK.

If I want to use Hammock with Couchbase .NET SDK in my project, what should I do to add Hammock back?

Thanks.

qingdou -

The Hammock client is no longer supported largely because the Hammock project itself is no longer maintained. That being said, the Hammock and RestSharp Http clients were moved to a separate assembly in the solution and can still be used.

To do so:

  • Clone or fork the source from Github: https://github.com/couchbase/couchbase-net-client
  • Create a new project and reference Couchbase, Couchbase.HttpClients and Enyim.Caching
  • Setup your config file like this:
<?xml version="1.0" encoding="utf-8" ?>

I just tried the steps above and it worked as expected, however, I would advise you to use the DefaultHttpCLient which comes with the Couchbase project in any production deployment.

Thanks,

Jeff

Thanks, Jeff. It works! Yes, you are right. Finally we decide to use the DefaultHttpClient.

Thanks, Jeff. It works! Yes, you are right. Finally we decide to use the DefaultHttpClient.