将RavenDB作为EmbeddableDocumentStore运行并访问RavenDB Management Studio

Len*_*rri 15 ravendb ravendb-studio

RavenDB-Embedded.1.0.499正在使用Visual Studio 2010中通过NuGet安装的嵌入式RavenDB => 包.它在我阅读这篇优秀的MSDN文章后开始的当前项目中使用:

将RavenDB嵌入到ASP.NET MVC 3应用程序中

现在我想访问RavenDB Management Studio(Web UI).

我按照这里描述的步骤进行操作:是否可以使用Raven Management Studio连接到嵌入式数据库,并在此处以嵌入模式运行RavenDB并启用HTTP,但我没有明白这一点.

这是我用来初始化的代码DocumentStore:

_documentStore = new EmbeddableDocumentStore
            {
                ConnectionStringName = "RavenDB",
                UseEmbeddedHttpServer = true
            };
Run Code Online (Sandbox Code Playgroud)

这就是ConnectionString现在Web.config:

<add name="RavenDB" connectionString="DataDir = ~\App_Data\Database" />
Run Code Online (Sandbox Code Playgroud)

我还阅读了RavenDB:Embedded Mode中描述的步骤.我试图手动启动服务器:

// Start the HTTP server manually
var server = new RavenDbHttpServer(documentStore.Configuration,
documentStore.DocumentDatabase);

server.Start();
Run Code Online (Sandbox Code Playgroud)

但上面的代码似乎已经过时,因为我没有RavenDbHttpServer,documentStore.Configuration而且documentStore.DocumentDatabase.我设法找到了,Raven.Database.Server.HttpServer但其他物体都没有了_documentStore.

所以,问题是:

如何点击Web UI来可视化我的嵌入式数据库文档?我应该在浏览器地址栏中放置什么URL?

任何建议表示赞赏.

编辑:我找到了让它发挥作用的方法.正如我在博客文章中描述的那样,它可能不是最好的方法,但确实有效:

RavenDB嵌入式Management Studio UI

注意:上述方法的一个缺点是我无法在我的应用程序中访问数据库,因为一旦服务器打开它就会被锁定.这样我就必须停止服务器,然后在浏览器中重新加载我的应用程序.

我希望RavenDB的大师有更好/更正确的方法......让我们知道.

Joh*_*ers 12

我从来没有必须手动运行服务器才能访问管理工作室.我通常在你的问题中没有提到的唯一几个步骤:

// Add the following line prior to calling documentStore.Initialize()
Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);
Run Code Online (Sandbox Code Playgroud)

复制Raven.Studio.xap到我的Web项目的根文件夹中.

当我的Web应用程序运行时,然后可以从http:// localhost:8080访问RavenDB Management Studio .