【问题标题】:How can I run RavenDB in a shared hosting environment?如何在共享主机环境中运行 RavenDB?
【发布时间】:2010-08-09 21:23:07
【问题描述】:

RavenDB 能够在“嵌入式​​”模式下运行,据我了解,这应该允许它在共享主机环境中运行。

有谁知道它将如何在 ASP.NET MVC 应用程序中工作,以及这样做的最佳实践是什么?

我需要注意托管环境中的任何依赖关系吗?

【问题讨论】:

标签: c# asp.net-mvc-2 shared-hosting ravendb


【解决方案1】:

是的。

我让 RavenDB 在共享托管环境 http://www.winhost.com/ 中运行,使用 ASP.NET MVC 3 和 RavenDB 1.0.0.371,它于 2011 年 7 月左右发布。

我的代码:

public static class Store
{
    private static IDocumentStore store = createStore();

    private static EmbeddableDocumentStore createStore()
    {
        var returnStore = new EmbeddableDocumentStore();
        returnStore.DataDirectory = @"./PersistedData";
        returnStore.Initialize();
        return returnStore;
    }

    public static xxx Read(string key)
    {
        using (var session = store.OpenSession())
        {

            var anEntity = session.Query<xxx>().
                Where(item => item.key == key).Single();
            return anEntity;
        }
    }

    public static void Write(xxx)
    {
        using (var session = store.OpenSession())
        {
            session.Store(xxx);
            session.SaveChanges();
        }
    }
}

目前唯一的缺点是我没有 RavenDB 管理工作室。

【讨论】:

  • 您可以尝试在管理工作室使用returnStore 上的UseEmbeddedHttpServer = true -> ravendb.net/faq/embedded-with-http
  • @David:太棒了...我整天都在寻找这个。在中等信任下运行 RavenDB 很痛苦,目前我认为这是不可能的。 WinHost 提供完全信任!伟大的。正是我需要的。
猜你喜欢
  • 2017-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-24
  • 1970-01-01
相关资源
最近更新 更多