asp.net-mvc-3 – 另一个数据库实例RavenDB MVC3已经使用的临时路径

前端之家收集整理的这篇文章主要介绍了asp.net-mvc-3 – 另一个数据库实例RavenDB MVC3已经使用的临时路径前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在运行 Windows 7 64位,RavenDB Embedded 1.0.701,MVC 3,C#,VS 2010 Pro.

按照RavenDB网站上的说明操作后,在asp.net页面的第一个RELOAD之后,我得到一个“无法打开事务存储:F:/ RavenDBDataStore / Data”内部异常“另一个数据库实例已经使用的临时路径”异常.

我尝试处理文档存储,但在我看来我得到了另一个例外.

public ActionResult Index()
{
    EmbeddableDocumentStore documentStore = new EmbeddableDocumentStore { DataDirectory = "F:/RavenDBDataStore/" };
    documentStore.Initialize(); // <--- this is were I get the exception after reloading the page
    Dictionary<string,object> test = new Dictionary<string,object> {
            { "Name",0 },{ "Price",3.99M },{ "Expiry",new DateTime(2008,12,28) },{ "Sizes",new string[] { "Small","Medium","Large" }} 
        };

    var results = new Object();
    using (IDocumentSession session = documentStore.OpenSession())
    {
        // Operations against session
        session.Store(test);
        session.SaveChanges();
        ViewBag.Display = session.Advanced.GetDocumentId(test);
        // Flush those changes
        session.SaveChanges();

        results = from c in session.Query<Dictionary<string,object>>()
                    select c;
    }
    return View(results);
}

解决方法

尝试按照此处描述的步骤操作:

Using RavenDB in an ASP.NET MVC website

特别关注管理会议部分……

如果您使用IIS Express调试应用程序,请在调试应用程序之前尝试将其删除

原文链接:https://www.f2er.com/aspnet/248399.html

猜你在找的asp.Net相关文章