【问题标题】:Cannot access RavenDB Management Studio无法访问 RavenDB Management Studio
【发布时间】:2012-06-17 02:18:23
【问题描述】:

试试:

  1. 我在VS2012中新建了一个项目
  2. 我通过 NuGet 包安装RavenDB Embedded -Pre
  3. 我安装了Ninject.MVC3
  4. 为 ninject RavenDB 添加了一个模块:

    Public class RavenDBNinjectModule : NinjectModule
    {
        public override void Load()
        {
        Bind<IDocumentStore>().ToMethod(context =>
        {
            NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);
            var documentStore = new EmbeddableDocumentStore { Url="http://localhost:8080/", DataDirectory="~/App_Data", UseEmbeddedHttpServer = true };
            return documentStore.Initialize();
        }).InSingletonScope();
    
        Bind<IDocumentSession>().ToMethod(context => context.Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope();
       }
    } 
    
  5. 在我的班级“NinjectWebCommon”...

    private static void RegisterServices(IKernel kernel)
    {
        kernel.Load(new RavenDBNinjectModule());
    } 
    

在运行应用程序时,生成了以下 url ("http://localhost:1423")

验证文件“Raven.Studio.xap”是我的应用程序的根目录

我尝试访问“http://localhost:8080”,但显示以下屏幕:

我做错了什么?

【问题讨论】:

  • 你确定documentStore.Initialize 真的被调用了吗?
  • 如果您在项目符号列表中发布代码 sn-ps,您需要将代码缩进至少 8 个空格(而不是通常的 4 个)
  • documentStore.Initialize 没有运行!谢谢,@FitzchakYitzchaki 你帮我找到了解决方案。写一个答案,我会批准!
  • @RidermandeSousaBarbosa 您能否更新一下您如何更改代码以使其正常工作?

标签: asp.net-mvc-4 ravendb ravendb-studio


【解决方案1】:

事实证明,问题在于 documentStore.Initialize 永远不会被调用,因为没有人要求 Ninject 解决 IDocumentStore

【讨论】:

    【解决方案2】:

    您正在设置 Url 属性,这意味着您不是在嵌入模式下运行,而是在服务器模式下运行。 删除 Url 属性,一切都会为您工作。

    【讨论】:

    • 我进行了更改。 var documentStore = new EmbeddableDocumentStore { DataDirectory="~/App_Data", UseEmbeddedHttpServer = true };其实一开始还不错,但是作为尝试放网址
    【解决方案3】:

    我发现了问题!

    由于他很快就使用了IDocumentSession,所以ninject没有创建IDocumentStore的实例,因此没有运行Initialize方法

    【讨论】:

    • 那么你是怎么解决的呢?我有同样的问题,对我的 MVC 应用程序的第一个请求有效,然后 raven 工作室接管了该应用程序 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-30
    • 2014-01-18
    • 1970-01-01
    相关资源
    最近更新 更多