Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在共享托管环境中运行RavenDB?_C#_Asp.net Mvc 2_Shared Hosting_Ravendb - Fatal编程技术网

C# 如何在共享托管环境中运行RavenDB?

C# 如何在共享托管环境中运行RavenDB?,c#,asp.net-mvc-2,shared-hosting,ravendb,C#,Asp.net Mvc 2,Shared Hosting,Ravendb,能够在“嵌入式”模式下运行,据我所知,应该允许它在共享托管环境中运行 有人知道它在ASP.NET MVC应用程序中是如何工作的吗?最好的做法是什么 托管环境中是否存在我需要注意的依赖项?是 我让RavenDB在一个共享的托管环境中运行,使用ASP.NET MVC 3和RavenDB 1.0.0.371,后者在2011年7月左右发布 我的代码: public static class Store { private static IDocumentStore store = createS

能够在“嵌入式”模式下运行,据我所知,应该允许它在共享托管环境中运行

有人知道它在ASP.NET MVC应用程序中是如何工作的吗?最好的做法是什么

托管环境中是否存在我需要注意的依赖项?

我让RavenDB在一个共享的托管环境中运行,使用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();
        }
    }
}
公共静态类存储
{
私有静态IDocumentStore=createStore();
私有静态EmbeddebleDocumentStore createStore()
{
var returnStore=new embeddedabledocumentstore();
returnStore.DataDirectory=@“/PersistedData”;
returnStore.Initialize();
退货店;
}
公共静态xxx读取(字符串键)
{
使用(var session=store.OpenSession())
{
var anEntity=session.Query()。
其中(item=>item.key==key).Single();
回归无实体;
}
}
公共静态无效写入(xxx)
{
使用(var session=store.OpenSession())
{
session.Store(xxx);
session.SaveChanges();
}
}
}

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

你可以尝试在管理工作室的
returnStore
上使用
UseMbeddedHttpServer=true
。。。我已经找了一整天了。在中等信任度下运行RavenDB是一种痛苦,目前我认为这是不可能的。WinHost提供完全信任!伟大的这正是我需要的。这取决于你的托管环境允许的权限。。。谢谢-这涵盖了我问题的第二部分(即依赖关系),但实际实现它的最佳实践如何?下载包含一个MVC示例,google group是一个活跃的社区,我相信您可以在其中找到具体问题的答案。如果您在,然后那个站台现在有一个从。是的,我今天早上看到了。我本来打算自己加一个答案,但你抢先了我一步。谢谢