compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (1)

View Page History

Also, please note that there were missing code paths in the current version of the Enyim.Caching client that was released with the .NET 1.1 library. Specifically, operation failures that should report a StatusCode were falling through to a "Node not found condition." An upcoming 1.1.7 release will patch Enyim and resolve this issue - also reducing (or eliminating) the need for the InnerResult structure that currently is in place.

h2. [#Using the CouchbaseClient in a WCF Application]

Unlike web applications, Windows services and console applications, WFC services are stateless. Typically, each client request is handled by a new instance of the service. This behavior makes it hard to manage a CouchbaseClient in the recommended way - once per app domain (or HTTPApplication instance).

If possible, you can avoid the performance penalties associated with client instantiation by setting your service to use the single instance context mode. When set to single, there will be a single instance of your service handling all client requests.

{code:java}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class Service : IService
{
}
{code}

If hosting in IIS using HTTP, you can also set your WCF application to use ASP.NET compatibility mode. In addition to enabling ASP.NET compatibility mode in your web.config, your service will need to specify it allows or requires ASP.NET compatibility.

{code:java}
[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
public class Service : IService
{
}
{code}

{code:xml}
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
{code}

With ASP.NET compatibility enabled, you will be able to add a Global.asax to your project and hook into its events.

{code:java}
public static CouchbaseClient Client = null;

protected void Application_Start(object sender, EventArgs e)
{
Client = new CouchbaseClient();
}
{code}