RavenDB version 2.5. Other versions:

Embedded

RavenDB makes it very easy to be embedded within your application. The first step is to reference the embedded client, either via nuget (package name: RavenDB-Embedded) or by taking the files from the build zip.

After referencing the embedded client from your project, all that is left to do is initializing:

    var documentStore = new EmbeddableDocumentStore
    {
    	DataDirectory = "Data"
    };
    

HTTP access

By default you don't have an external access to RavenDB, so if you want to use the WebUI to look at what the database is doing, or to use the REST API, you can't. Other features relying on being able to communicate over HTTP (like replication) will be disabled too.

RavenDB can be run in an embedded mode with HTTP enabled. To do that, you will just need to set another flag when initializing the embedded document store:

    var documentStore = new EmbeddableDocumentStore
    {
    	DataDirectory = "Data",
    	UseEmbeddedHttpServer = true
    };
    

Note that you may want to call NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port) to ensure that you can open the HTTP server without requiring administrator privileges.

Once you initialized the document store, you can browse directly to the WebUI, execute replication scenarios, etc.

Configuration

Many configuration options are available for tuning RavenDB and fitting it to your needs. See the Configuration options page for complete info.

Comments add new comment

The comments section is for user feedback or community content. If you seek assistance or have any questions, please post them at our support forums.

Kieron
REPLY Posted by Kieron on

Is it possible to read the content of an embedded database using the Raven Studio application (Raven.Studio.xap), or something similar?

Ayende Rahien
REPLY Posted by Ayende Rahien on

Yes, you can do it by doing:

UseEmbeddedHttpServer = true on the document store.

DalSoft
REPLY Posted by DalSoft on

I've written a step by guide to getting RavenDB embedded up and running, including Management Studio. http://www.dalsoft.co.uk/blog/index.php/2012/04/12/mvc-get-ravendb-up-and-running-in-5-minutes-using-ninject/

Merrycoder
REPLY Posted by Merrycoder on

Is the embedded dB thread safe? I would like to use it as an in-process cache in a Web application to minimize SQL db calls.

Ayende Rahien
REPLY Posted by Ayende Rahien on

Yes, RavenDB, in all modes (server, cloud, azure) is fully thread safe

Gynnbleid1
REPLY Posted by Gynnbleid1 on

Hi! Is it possible to browse database Embedded in Windows Forms application using Management Studio?

Ayende Rahien
REPLY Posted by Ayende Rahien on

Yes, you can set UseEmbeddedHttpServer, see discussion on that in this page

Gwynnbleid1
REPLY Posted by Gwynnbleid1 on

I tried to add UseEmbeddedHttpServer = true setting, but initialization returns HttpListenerException: "Access is denied"

Ayende Rahien
REPLY Posted by Ayende Rahien on

You have to be admin

Gwynnbleid1
REPLY Posted by Gwynnbleid1 on

Thanks a lot for help!!! Running as admin solved my problem.

Harry McIntyre
REPLY Posted by Harry McIntyre on

You can also add a url acl e.g. if you are running under IIS as a non-admin app pool user:

C:\Windows\system32>netsh http add urlacl url=http://+:8080/ user="IIS APPPOOL\<app pool name>"

Tjeerd Hans
REPLY Posted by Tjeerd Hans on

If you're starting out with a new store, make sure you Initialize() it first before accessing the Management Studio.

Vivek
REPLY Posted by Vivek on

PM> Install-Package RavenDB-Embedded Install-Package : Unable to find package 'RavenDB-Embedded'. At line:1 char:16 + Install-Package <<<< RavenDB-Embedded + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Ayende Rahien
REPLY Posted by Ayende Rahien on

Please ask in the mailing list, this is not the place for support questions

Casey Burns
REPLY Posted by Casey Burns on

This didn't for me first time, using MVC4 and IISExpress.

I had to set the VirtualDirectory: store.Configuration.VirtualDirectory = "/db";

Then it worked; localhost[port]/db

Behailu
REPLY Posted by Behailu on

Hello, I am using the embedded version of RavenDb to build a school project and everything was fine but after adding few documents, it starts to remove the previous ones. Please help, what did I do wrong?

SUBMIT COMMENT