为什么我不能在新的asp.net MVC网站上使用嵌入式RavenDB?
我已经在一个简单的.net控制台应用程序中成功尝试并测试了以下代码。它运行得很好,直到我尝试在MVC网站上使用它。
它不会抛出任何错误,它只是在尝试Initialize()
后挂起在我的错误查找过程中,我在localhost上安装了一个RavenDB服务器,我可以在我的MVC应用程序中连接它 - 这不是问题。但是在我安装localhost RavenDB之前以及之后的初始化错误。
我希望你能解决这个问题!
public static class Store {
private static IDocumentStore store = createStore();
private static EmbeddableDocumentStore createStore() {
var returnStore = new EmbeddableDocumentStore();
returnStore.DataDirectory = @"./PersistedData";
returnStore.Initialize(); // It never gets past this in any MVC website
return returnStore;
}
public static myDocument Read(string key) {
using (var session = store.OpenSession()) {
var anEntity = session.Query<myDocument>().Where(item => item.key == key).Single();
return anEntity;
}
}
public static void Write(myDocument d) {
using (var session = store.OpenSession()) {
session.Store(d);
session.SaveChanges();
}
}
}
public class myDocument {
public string key { get; set; }
public string description { get; set; }
}
更新
记录以下错误并显示在事件查看器中:
INFORMATION: Raven (11096) 1-RT4um-C:\Users\***\RavenEmbed\./PersistedData\Data:
The database engine attached a database (1, C:\Users\***\RavenEmbed\PersistedData\Data).
(Time=0 seconds)
ERROR: Windows cannot open the 64-bit extensible counter DLL ASP.NET_64_2.0.50727 in a
32-bit environment. Contact the file vendor to obtain a 32-bit version. Alternatively if
you are running a 64-bit native environment, you can open the 64-bit extensible counter
DLL by using the 64-bit version of Performance Monitor. To use this tool, open the
Windows folder, open the System32 folder, and then start Perfmon.exe.
ERROR: Disabled performance counter data collection for this session from the
"ASP.NET_64_2.0.50727" service because the performance counter library for that service
has generated one or more errors. The errors that forced this action have been written
to the application event log.
ERROR: The Open Procedure for service "BITS" in DLL "C:\Windows\System32\bitsperf.dll"
failed. Performance data for this service will not be available. The first four bytes
(DWORD) of the Data section contains the error code.
ERROR: The Open Procedure for service "Lsa" in DLL "C:\Windows\System32\Secur32.dll"
failed. Performance data for this service will not be available. The first four bytes
(DWORD) of the Data section contains the error code.
ERROR: The Open Procedure for service "MSDTC" in DLL "C:\Windows\system32\msdtcuiu.DLL"
failed. Performance data for this service will not be available. The first four bytes
(DWORD) of the Data section contains the error code.
ERROR: The configuration information of the performance library "perf-MSSQL$SQLEXPRESS-
sqlctr11.1.3000.0.dll" for the "MSSQL$SQLEXPRESS" service does not match the trusted
performance library information stored in the registry. The functions in this library
will not be treated as trusted.
更新2
我可以从此链接下载MVC 3项目,该项目有效。但我仍然不能将MVC 4嵌入式RavenDB工作。
http://archive.msdn.microsoft.com/mag201111NoSQL/Release/ProjectReleases.aspx?ReleaseId=5778