【发布时间】:2011-11-13 16:33:12
【问题描述】:
我正在使用通过 NuGet 在 Visual Studio 2010 中安装的嵌入式 RavenDB => RavenDB-Embedded.1.0.499 包。我在阅读这篇出色的 MSDN 文章后开始在当前项目中使用它:
Embedding RavenDB into an ASP.NET MVC 3 Application
现在我想访问RavenDB Management Studio(Web UI)。
我按照此处描述的步骤操作:Is it possible to connect to an embedded DB with Raven Management Studio 和此处Running RavenDB in embedded mode with HTTP enabled,但我没有明白这一点。
这是我用来初始化DocumentStore的代码:
_documentStore = new EmbeddableDocumentStore
{
ConnectionStringName = "RavenDB",
UseEmbeddedHttpServer = true
};
这是Web.config中的ConnectionString:
<add name="RavenDB" connectionString="DataDir = ~\App_Data\Database" />
我还阅读了RavenDB: Embedded Mode 中描述的步骤。我尝试手动启动服务器:
// Start the HTTP server manually
var server = new RavenDbHttpServer(documentStore.Configuration,
documentStore.DocumentDatabase);
server.Start();
但上面的代码似乎已经过时了,因为我没有 RavenDbHttpServer、documentStore.Configuration 和 documentStore.DocumentDatabase。我设法找到了Raven.Database.Server.HttpServer,但_documentStore 中缺少其他对象。
所以,问题是:
如何点击 Web UI 来可视化我的嵌入式数据库文档?我应该在浏览器地址栏中输入什么 URL?
感谢任何建议。
编辑:我找到了让它工作的方法。正如我在博客文章中所描述的,这可能不是最好的方法,但确实有效:
RavenDB Embedded with Management Studio UI
注意:上述方法的一个缺点是我无法访问我的应用程序中的数据库,因为一旦它被服务器打开它就会被锁定。这样我必须停止服务器,然后在浏览器中重新加载我的应用程序。
我希望 RavenDB 的大师们有更好/正确的方法......请告诉我们。
【问题讨论】: