2012-06-23 28 views
2

最近,我已經安裝RavenDB(一堆程序集:客戶端,數據庫,嵌入式)通過NuGet程序包管理器。我已經配置DocumentStore這樣的:訪問RavenDB時獲取System.Net.Sockets.SocketException

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(); 
} 

後這段代碼被稱爲:

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

我得到System.Net.Sockets.SocketException

無連接可以作出,因爲 目標機器積極拒絕它127.0.0.1:8080

我錯過了什麼?

回答

2

你設置的東西,像這樣:

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

的問題是,這實際上告訴我們,不使用嵌入模式,而是試圖在東西服務器客戶端的方式。 將其更改爲:

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

,它會工作