{"id":1845,"date":"2014-12-16T17:18:35","date_gmt":"2014-12-16T17:18:34","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1845"},"modified":"2025-06-13T23:52:04","modified_gmt":"2025-06-14T06:52:04","slug":"xdcr-aspnet-and-nancy","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/ko\/xdcr-aspnet-and-nancy\/","title":{"rendered":"ASP.NET \ubc0f Nancy\ub97c \uc0ac\uc6a9\ud55c XDCR"},"content":{"rendered":"<p>You&#8217;re probably aware of the new Cross Data Center Replication (<a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/3.x\/admin\/XDCR\/xdcr-intro.html\">XDCR<\/a>) feature of Couchbase Server 2.0.\u00a0 Its most obvious utility is to allow you to replicate data from one Couchbase cluster to another.\u00a0 However, there are more novel use cases for XDCR.\u00a0 One of the more notable examples is Couchbase and Elastic Search integration.<\/p>\n<p>Performing XDCR against a non-Couchbase cluster is possible because the communication endpoint is implemented using a simple RESTful API.\u00a0 By implementing a few simple methods, you can setup your own replication endpoint.\u00a0 There are a variety of reasons you might want to build your own XDCR endpoint.\u00a0 One simple example is to receive change notifications.<\/p>\n<p>Setting up an endpoint is pretty straightforward and may be done using any web framework suitable for building RESTful APIs.\u00a0 In .NET, one option is ASP.NET MVC and the new Web API.\u00a0 While a good option, a simpler solution would be to use the <a href=\"https:\/\/www.sinatrarb.com\">Sinatra<\/a> inspired <a href=\"https:\/\/nancyfx.org\/\">Nancy<\/a>.<\/p>\n<p>Nancy is a lightweight, microframework for building HTTP based applications with .NET.\u00a0 In the most basic case, you create a module that extends from <em>NancyModule<\/em> and create a route and handler.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\"><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">class<\/span> SampleModule <span style=\"color: #008000;\">:<\/span> Nancy<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">NancyModule<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">public<\/span> SampleModule<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nGet<span style=\"color: #008000;\">[<\/span><span style=\"color: #666666;\">&#8220;\/&#8221;<\/span><span style=\"color: #008000;\">]<\/span> <span style=\"color: #008000;\">=<\/span> _ <span style=\"color: #008000;\">=&gt;<\/span> <span style=\"color: #666666;\">&#8220;Hello World!&#8221;<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>To demonstrate how to create an XDCR endpoint using Nancy, I&#8217;ve published a Couchbase Labs project on GitHub named <a href=\"https:\/\/github.com\/couchbaselabs\/couchbase-xdcr-nancy\">couchbase-xdcr-nancy<\/a>.\u00a0 This project is based heavily on Jasdeep&#8217;s <a href=\"https:\/\/github.com\/scalabl3\/couchbase-xdcr-sinatra\">couchbase-xdcr-sinatra<\/a> code.<\/p>\n<p>Inside the Visual Studio project, you&#8217;ll find a number of plumbing files.\u00a0 I won&#8217;t go over the code in detail here, but will show a couple of highlights.\u00a0 The most important code is inside of the <em>XdcrModule<\/em> class.\u00a0 It&#8217;s there where you&#8217;ll find the handlers for the various resource requests made by the XDCR service.<\/p>\n<p>Within the constructor for this module, you&#8217;ll find a handfull of GET handlers that handle requests to URIs starting with \/pools.\u00a0 These are effectively handshake URIs used by XDCR to discover information about the cluster and its buckets (similar to the endpoints used by Couchbase SDKs to bootstrap client instances).\u00a0 Note that in this sample, the bucket is hardcoded to &#8220;default.&#8221;\u00a0 You could easily modify that value or make it a configuration setting.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p>Get<span style=\"color: #008000;\">[<\/span><span style=\"color: #666666;\">&#8220;\/pools&#8221;<\/span><span style=\"color: #008000;\">]<\/span> <span style=\"color: #008000;\">=<\/span> x <span style=\"color: #008000;\">=&gt;<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nvar output <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\npools <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> <span style=\"color: #6666cc; font-weight: bold;\">object<\/span><span style=\"color: #008000;\">[<\/span><span style=\"color: #008000;\">]<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> <span style=\"color: #008000;\">{<\/span> name <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">&#8220;default&#8221;<\/span>, uri <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">&#8220;\/pools\/default?uuid=&#8221;<\/span> <span style=\"color: #008000;\">+<\/span> UUID_POOL <span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span>,<br \/>\nuuid <span style=\"color: #008000;\">=<\/span> UUID_POOL<br \/>\n<span style=\"color: #008000;\">}<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">return<\/span> Response<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">AsJson<\/span><span style=\"color: #008000;\">(<\/span>output<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<\/div>\n<\/div>\n<p>After the GET handlers, there are a couple of POST handlers that respond to the actual XDCR feed.\u00a0 The XDCR service will pass parameters as part of the path.\u00a0 Regex based routes are used for this purpose.<\/p>\n<p>The first POST handler receives a list of documents and their revisions from the XDCR service.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p>Post<span style=\"color: #008000;\">[<\/span>REGEX_REVS_DIFF<span style=\"color: #008000;\">]<\/span> <span style=\"color: #008000;\">=<\/span> x <span style=\"color: #008000;\">=&gt;<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nvar body <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">&#8220;&#8221;<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nContext<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Request<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Body<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Position<\/span> <span style=\"color: #008000;\">=<\/span> <span style=\"color: #ff0000;\">0<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">using<\/span> <span style=\"color: #008000;\">(<\/span>var sr <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> StreamReader<span style=\"color: #008000;\">(<\/span>Context<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Request<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Body<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nbody <span style=\"color: #008000;\">=<\/span> sr<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">ReadToEnd<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><br \/>\nvar jobj <span style=\"color: #008000;\">=<\/span> JObject<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Parse<\/span><span style=\"color: #008000;\">(<\/span>body<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>var outDict <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> Dictionary<span style=\"color: #008000;\">&lt;<\/span><span style=\"color: #6666cc; font-weight: bold;\">string<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">object<\/span><span style=\"color: #008000;\">=<\/span><span style=\"color: #666666;\">&#8220;&#8221;<\/span><span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">foreach<\/span> <span style=\"color: #008000;\">(<\/span>var item <span style=\"color: #0600ff; font-weight: bold;\">in<\/span> jobj<span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nvar key <span style=\"color: #008000;\">=<\/span> item<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Key<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar rev <span style=\"color: #008000;\">=<\/span> item<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">ToString<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">if<\/span> <span style=\"color: #008000;\">(<\/span>handler<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">IsMissing<\/span><span style=\"color: #008000;\">(<\/span>key, rev<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\noutDict<span style=\"color: #008000;\">[<\/span>key<span style=\"color: #008000;\">]<\/span> <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> <span style=\"color: #008000;\">{<\/span> missing <span style=\"color: #008000;\">=<\/span> rev <span style=\"color: #008000;\">}<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">return<\/span> Response<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">AsJson<\/span><span style=\"color: #008000;\">(<\/span>outDict<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><span style=\"color: #008000;\">;<span style=\"color: #6666cc; font-weight: bold;\">string<\/span>,<span style=\"color: #008000;\">&gt;<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p>Within this handler, the JSON is parsed to discover the key and revision.\u00a0 If that combination is not found to be replicated, then it is added to the list of &#8220;missing&#8221; keys included in the response to the request.\u00a0 XDCR will then send those documents to the another POST handler, where they&#8217;ll be created.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p>Post<span style=\"color: #008000;\">[<\/span>REGEX_BULK_DOCS<span style=\"color: #008000;\">]<\/span> <span style=\"color: #008000;\">=<\/span> x <span style=\"color: #008000;\">=&gt;<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nvar body <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">&#8220;&#8221;<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nContext<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Request<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Body<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Position<\/span> <span style=\"color: #008000;\">=<\/span> <span style=\"color: #ff0000;\">0<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">using<\/span> <span style=\"color: #008000;\">(<\/span>var sr <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> StreamReader<span style=\"color: #008000;\">(<\/span>Context<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Request<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Body<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nbody <span style=\"color: #008000;\">=<\/span> sr<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">ReadToEnd<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><br \/>\nvar jobj <span style=\"color: #008000;\">=<\/span> JObject<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Parse<\/span><span style=\"color: #008000;\">(<\/span>body<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>var newEdits <span style=\"color: #008000;\">=<\/span> jobj<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">&lt;<\/span><span style=\"color: #6666cc; font-weight: bold;\">bool<\/span><span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;new_edits&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar docs <span style=\"color: #008000;\">=<\/span> jobj<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">&lt;<\/span>JArray<span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;docs&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">foreach<\/span> <span style=\"color: #008000;\">(<\/span>var doc <span style=\"color: #0600ff; font-weight: bold;\">in<\/span> docs<span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nvar originalDoc <span style=\"color: #008000;\">=<\/span> Encoding<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">UTF8<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">GetString<\/span><span style=\"color: #008000;\">(<\/span>Convert<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">FromBase64String<\/span><span style=\"color: #008000;\">(<\/span>doc<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">&lt;<\/span><span style=\"color: #6666cc; font-weight: bold;\">string<\/span><span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;base64&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar meta <span style=\"color: #008000;\">=<\/span> doc<span style=\"color: #008000;\">[<\/span><span style=\"color: #666666;\">&#8220;meta&#8221;<\/span><span style=\"color: #008000;\">]<\/span> <span style=\"color: #0600ff; font-weight: bold;\">as<\/span> JObject<span style=\"color: #008000;\">;<\/span><\/p>\n<p>var document <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> Document<br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nId <span style=\"color: #008000;\">=<\/span> meta<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">&lt;<\/span><span style=\"color: #6666cc; font-weight: bold;\">string<\/span><span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;id&#8221;<\/span><span style=\"color: #008000;\">)<\/span>,<br \/>\nRevision <span style=\"color: #008000;\">=<\/span> meta<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">&lt;<\/span><span style=\"color: #6666cc; font-weight: bold;\">string<\/span><span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;rev&#8221;<\/span><span style=\"color: #008000;\">)<\/span>,<br \/>\nExpiration <span style=\"color: #008000;\">=<\/span> meta<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">&lt;<\/span><span style=\"color: #6666cc; font-weight: bold;\">int<\/span><span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;expiration&#8221;<\/span><span style=\"color: #008000;\">)<\/span>,<br \/>\nFlags <span style=\"color: #008000;\">=<\/span> meta<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">&lt;<\/span><span style=\"color: #6666cc; font-weight: bold;\">int<\/span><span style=\"color: #008000;\">&gt;<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;flags&#8221;<\/span><span style=\"color: #008000;\">)<\/span>,<br \/>\nValue <span style=\"color: #008000;\">=<\/span> originalDoc<br \/>\n<span style=\"color: #008000;\">}<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>handler<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">CreateDocument<\/span><span style=\"color: #008000;\">(<\/span>document<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">return<\/span> HttpStatusCode<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Created<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<\/div>\n<\/div>\n<p>Within the sample, I&#8217;ve included a very simple interface used to create a pluggable handler that will check the existence of the document and create it when necessary.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">interface<\/span> IReplicationHandler<br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #6666cc; font-weight: bold;\">bool<\/span> IsMissing<span style=\"color: #008000;\">(<\/span><span style=\"color: #6666cc; font-weight: bold;\">string<\/span> key, <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> rev<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p><span style=\"color: #6666cc; font-weight: bold;\">void<\/span> CreateDocument<span style=\"color: #008000;\">(<\/span>Document document<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<\/div>\n<\/div>\n<p>For demonstration purposes, I&#8217;ve also included an <em>XmlReplicator<\/em> class that implements this interface.\u00a0 This class uses LINQ to XML to update and query an XML document that contains documents fed to it by the XDCR service.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">class<\/span> XmlReplicator <span style=\"color: #008000;\">:<\/span> IReplicationHandler<br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">private<\/span> <span style=\"color: #0600ff; font-weight: bold;\">readonly<\/span> <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> _path<span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">private<\/span> XDocument doc <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XDocument<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> XmlReplicator<span style=\"color: #008000;\">(<\/span><span style=\"color: #6666cc; font-weight: bold;\">string<\/span> path <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">@&#8221;C:tempreplication.xml&#8221;<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n_path <span style=\"color: #008000;\">=<\/span> path<span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">if<\/span> <span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">!<\/span> File<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Exists<\/span><span style=\"color: #008000;\">(<\/span>_path<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\n<span style=\"color: #008080; font-style: italic;\">\/\/var xml = new XElement(&#8220;documents&#8221;);<\/span><br \/>\nFile<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">WriteAllText<\/span><span style=\"color: #008000;\">(<\/span>path,<span style=\"color: #666666;\">&#8220;<!--?xml version=&lt;span style=\"color: #008080; font-weight: bold;\"&gt;\"&lt;\/span&gt;1.0&lt;span style=\"color: #008080; font-weight: bold;\"&gt;\"&lt;\/span&gt; encoding=&lt;span style=\"color: #008080; font-weight: bold;\"&gt;\"&lt;\/span&gt;utf-8&lt;span style=\"color: #008080; font-weight: bold;\"&gt;\"&lt;\/span&gt;?-->&#8220;<\/span>, Encoding<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">UTF8<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #008000;\">&#8230;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<\/div>\n<\/div>\n<p>To check if the document exists, <em>IsMissing <\/em>will query the XML for a <em>document <\/em>element that has child <em>id<\/em> and <em>rev<\/em> elements matching the supplied key and revision.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\"><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">bool<\/span> IsMissing<span style=\"color: #008000;\">(<\/span><span style=\"color: #6666cc; font-weight: bold;\">string<\/span> key, <span style=\"color: #6666cc; font-weight: bold;\">string<\/span> rev<span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nvar xml <span style=\"color: #008000;\">=<\/span> XDocument<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Load<\/span><span style=\"color: #008000;\">(<\/span>_path<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar documents <span style=\"color: #008000;\">=<\/span> xml<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Document<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Root<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Elements<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;document&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nvar document <span style=\"color: #008000;\">=<\/span> documents<span style=\"color: #008000;\">.<\/span><span style=\"color: #0600ff; font-weight: bold;\">Where<\/span><span style=\"color: #008000;\">(<\/span>d <span style=\"color: #008000;\">=&gt;<\/span> d<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Element<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;meta&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Element<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;rev&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span> <span style=\"color: #008000;\">==<\/span> rev <span style=\"color: #008000;\">&amp;&amp;<\/span> d<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Element<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;meta&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Element<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;id&#8221;<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span> <span style=\"color: #008000;\">==<\/span> key<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #0600ff; font-weight: bold;\">return<\/span> document<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Count<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span> <span style=\"color: #008000;\">==<\/span> <span style=\"color: #ff0000;\">0<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>Documents are created simply by adding them to the existing XML file.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family: monospace;\">\n<p><span style=\"color: #0600ff; font-weight: bold;\">public<\/span> <span style=\"color: #6666cc; font-weight: bold;\">void<\/span> CreateDocument<span style=\"color: #008000;\">(<\/span>Document document<span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">{<\/span><br \/>\nvar xml <span style=\"color: #008000;\">=<\/span> XDocument<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Load<\/span><span style=\"color: #008000;\">(<\/span>_path<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>var docElement <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XElement<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;document&#8221;<\/span>,<br \/>\n<a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XElement<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;meta&#8221;<\/span>,<br \/>\n<a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XElement<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;id&#8221;<\/span>, document<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Id<\/span><span style=\"color: #008000;\">)<\/span>,<br \/>\n<a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XElement<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;rev&#8221;<\/span>, document<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Revision<\/span><span style=\"color: #008000;\">)<\/span>,<br \/>\n<a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XElement<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;expiration&#8221;<\/span>, document<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Expiration<\/span><span style=\"color: #008000;\">)<\/span>,<br \/>\n<a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XElement<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;flags&#8221;<\/span>, document<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Flags<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">)<\/span>,<br \/>\n<a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XElement<span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">&#8220;value&#8221;<\/span>, <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">new<\/span><\/a> XCData<span style=\"color: #008000;\">(<\/span>document<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Value<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">)<\/span><br \/>\n<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>xml<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Document<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Root<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Add<\/span><span style=\"color: #008000;\">(<\/span>docElement<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\nxml<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000ff;\">Save<\/span><span style=\"color: #008000;\">(<\/span>_path<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\n<span style=\"color: #008000;\">}<\/span><\/p>\n<\/div>\n<\/div>\n<p>By default, I&#8217;ve set up Nancy to use the ASP.NET development server.\u00a0 You can host Nancy however you wish (IIS, self hosted, etc.).\u00a0 Once you have the project running, you&#8217;ll need to setup XDCR in the Couchbase admin console.\u00a0 Some values to know:<\/p>\n<ul>\n<li>Nancy port &#8211; 8675 (you can modify this in the project settings)<\/li>\n<li>Nancy basic auth: Administrator:qwerty (modify this in <em>XdcrUserValidator<\/em>)<\/li>\n<\/ul>\n<p>Finally, to plugin your own <em>IReplicationHandler<\/em> instance, simply register your type in the <em>ApplicationBootstrapper<\/em> (or delete the other implementations).<\/p>\n<p><em>container.Register(new XmlReplicator());<\/em><\/p>\n<p>Remember that CouchbaseLabs projects aren&#8217;t fully supported, but feel free to post questions to the forums.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You&#8217;re probably aware of the new Cross Data Center Replication (XDCR) feature of Couchbase Server 2.0.\u00a0 Its most obvious utility is to allow you to replicate data from one Couchbase cluster to another.\u00a0 However, there are more novel use cases [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[10126,9415],"tags":[],"ppma_author":[8980],"class_list":["post-1845","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-asp-dotnet","category-xdcr"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>XDCR with ASP.NET and Nancy - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/ko\/xdcr-aspnet-and-nancy\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"XDCR with ASP.NET and Nancy\" \/>\n<meta property=\"og:description\" content=\"You&#8217;re probably aware of the new Cross Data Center Replication (XDCR) feature of Couchbase Server 2.0.\u00a0 Its most obvious utility is to allow you to replicate data from one Couchbase cluster to another.\u00a0 However, there are more novel use cases [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/ko\/xdcr-aspnet-and-nancy\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-16T17:18:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T06:52:04+00:00\" \/>\n<meta name=\"author\" content=\"John Zablocki, NET. SDK Developer, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Zablocki, NET. SDK Developer, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/\"},\"author\":{\"name\":\"John Zablocki, NET. SDK Developer, Couchbase\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/ee312fb775c13d20a32f1d455888a282\"},\"headline\":\"XDCR with ASP.NET and Nancy\",\"datePublished\":\"2014-12-16T17:18:34+00:00\",\"dateModified\":\"2025-06-14T06:52:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/\"},\"wordCount\":1037,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"ASP.NET\",\"Cross Data Center Replication (XDCR)\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/\",\"name\":\"XDCR with ASP.NET and Nancy - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2014-12-16T17:18:34+00:00\",\"dateModified\":\"2025-06-14T06:52:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/xdcr-aspnet-and-nancy\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"XDCR with ASP.NET and Nancy\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/ee312fb775c13d20a32f1d455888a282\",\"name\":\"John Zablocki, NET. SDK Developer, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g201925d9efc4992ce80385b76fdea34b\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g\",\"caption\":\"John Zablocki, NET. SDK Developer, Couchbase\"},\"description\":\"John Zablocki is a NET. SDK Developer at Couchbase. John is also the organizer of Beantown ALT.NET and a former adjunct at Fairfield University. You can also check out the book on Amazon named \\\"Couchbase Essentials\\\" which explains how to install and configure Couchbase Server.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/ko\\\/author\\\/john-zablocki\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"XDCR with ASP.NET and Nancy - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/ko\/xdcr-aspnet-and-nancy\/","og_locale":"ko_KR","og_type":"article","og_title":"XDCR with ASP.NET and Nancy","og_description":"You&#8217;re probably aware of the new Cross Data Center Replication (XDCR) feature of Couchbase Server 2.0.\u00a0 Its most obvious utility is to allow you to replicate data from one Couchbase cluster to another.\u00a0 However, there are more novel use cases [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/ko\/xdcr-aspnet-and-nancy\/","og_site_name":"The Couchbase Blog","article_published_time":"2014-12-16T17:18:34+00:00","article_modified_time":"2025-06-14T06:52:04+00:00","author":"John Zablocki, NET. SDK Developer, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"John Zablocki, NET. SDK Developer, Couchbase","Est. reading time":"5\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/"},"author":{"name":"John Zablocki, NET. SDK Developer, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282"},"headline":"XDCR with ASP.NET and Nancy","datePublished":"2014-12-16T17:18:34+00:00","dateModified":"2025-06-14T06:52:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/"},"wordCount":1037,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["ASP.NET","Cross Data Center Replication (XDCR)"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/","url":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/","name":"XDCR with ASP.NET and Nancy - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2014-12-16T17:18:34+00:00","dateModified":"2025-06-14T06:52:04+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/xdcr-aspnet-and-nancy\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"XDCR with ASP.NET and Nancy"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \ube14\ub85c\uadf8","description":"NoSQL \ub370\uc774\ud130\ubca0\uc774\uc2a4, Couchbase","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \ube14\ub85c\uadf8","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282","name":"\uc874 \uc790\ube14\ub85c\ud0a4, NET. SDK \uac1c\ubc1c\uc790, Couchbase","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g201925d9efc4992ce80385b76fdea34b","url":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","caption":"John Zablocki, NET. SDK Developer, Couchbase"},"description":"John Zablocki is a NET. SDK Developer at Couchbase. John is also the organizer of Beantown ALT.NET and a former adjunct at Fairfield University. You can also check out the book on Amazon named \"Couchbase Essentials\" which explains how to install and configure Couchbase Server.","url":"https:\/\/www.couchbase.com\/blog\/ko\/author\/john-zablocki\/"}]}},"acf":[],"authors":[{"term_id":8980,"user_id":22,"is_guest":0,"slug":"john-zablocki","display_name":"John Zablocki, NET. SDK Developer, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/1845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/comments?post=1845"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/1845\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media?parent=1845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/categories?post=1845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/tags?post=1845"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/ppma_author?post=1845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}