lexeme
lexeme

Reputation: 2973

Getting System.Net.Sockets.SocketException while accessing RavenDB

Recently I've installed RavenDB (a bunch of assemblies: client, database, embedded) thru NuGet package manager. I have configured DocumentStore like this:

public override void Load()
{
    Bind<IDocumentStore>().ToMethod(
        context => {
            var documentStore = new EmbeddableDocumentStore { 
                Url = "http://localhost:8080", 
                DefaultDatabase = "ampDatabase",
                UseEmbeddedHttpServer = true
            };
            return documentStore.Initialize();
        }
    ).InSingletonScope();

    Bind<IDocumentSession>().ToMethod(context => 
        context.Kernel.Get<IDocumentStore>().OpenSession()
    ).InRequestScope();
}

After this code is called:

documentSession.Store(idea);
documentSession.SaveChanges();

I'm getting System.Net.Sockets.SocketException:

No connection could be made because the target machine actively refused it 127.0.0.1:8080

What have I missed?

Upvotes: 2

Views: 947

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

You set things up like this:

 var documentStore = new EmbeddableDocumentStore { 
                Url = "http://localhost:8080", 
                DefaultDatabase = "ampDatabase",
                UseEmbeddedHttpServer = true
            };

The problem is that this actually tells us to NOT use embedded mode, but to try to things in a server client manner. Change it to be:

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

And it will work

Upvotes: 2

Related Questions