我正在嘗試讓我的ASP.NET MVC4項目中運行的RavenDb的迷你分析器。RavenDb Mini Profiler只在第一頁加載時加載
我在我的團結引導程序如下:
[assembly: WebActivator.PreApplicationStartMethod(typeof(Web.App.App_Start.AppStart_Unity), "Start")]
public static class AppStart_Unity
{
public static void RegisterServices(IUnityContainer container)
{
container.RegisterInstance(DocumentStoreFactory.Create(ConfigurationManager.ConnectionStrings[0].Name));
container.RegisterType<IDocumentSession>(new HierarchicalLifetimeManager(), new InjectionFactory(c => c.Resolve<IDocumentStore>().OpenSession(ConfigurationManager.ConnectionStrings[0].Name)));
}
public static void Start()
{
// Create the unity container
IUnityContainer container = new UnityContainer();
// Register services with our Unity container
RegisterServices(container);
// Tell ASP.NET MVC to use our Unity DI container
DependencyResolver.SetResolver(new UnityServiceLocator(container));
// hook up the profiler
var store = container.Resolve<IDocumentStore>();
var documentStore = store as DocumentStore;
if (documentStore != null)
{
Raven.Client.MvcIntegration.RavenProfiler.InitializeFor(documentStore);
}
}
}
在我的主人_layout我有以下幾點:
<head>
@Raven.Client.MvcIntegration.RavenProfiler.CurrentRequestSessions()
</head>
我第一次啓動Web應用程序,我可以看到分析器, 沒問題。
但是,任何後續頁面請求和分析器都不可見。
當我看到頁面源,我可以看到div容器在那裏,但沒有數據填充。沒有JavaScript錯誤。很奇怪。呈現的HTML看起來像這樣:
<div class="ravendb-profiler-results">
<div id="ravendb-session-container"></div>
<p></p>
<a href="#" class="ravendb-toggle ravendb-close">Close</a>
</div>
的要求進行比較,我看到在第一負載這些請求:
http://localhost:62238/ravendb/profiling?path=yepnope.js
http://localhost:62238/ravendb/profiling?path=jquery.tmpl.min.js
http://localhost:62238/ravendb/profiling?path=ravendb-profiler-scripts.js
http://localhost:62238/ravendb/profiling?path=jquery.tmpl.min.js
http://localhost:62238/ravendb/profiling?path=ravendb-profiler-scripts.js
http://localhost:62238/ravendb/profiling?path=Templates%2Ftotals.tmpl.html
http://localhost:62238/ravendb/profiling?path=Templates%2Fravendb-profiler.tmpl.html
http://localhost:62238/ravendb/profiling?path=Templates%2Fsession-template.tmpl.html
http://localhost:62238/ravendb/profiling?path=Templates%2Frequest-details.tmpl.html
http://localhost:62238/ravendb/profiling?id%5B%5D=d3ada4e4-4bc3-4a7c-bd36-64cc8017d94a
http://localhost:62238/ravendb/profiling?path=styles.css
在隨後的負載,我看到了以下要求:
http://localhost:62238/ravendb/profiling?path=yepnope.js
http://localhost:62238/ravendb/profiling?path=jquery.tmpl.min.js
http://localhost:62238/ravendb/profiling?path=ravendb-profiler-scripts.js
http://localhost:62238/ravendb/profiling?path=jquery.tmpl.min.js
http://localhost:62238/ravendb/profiling?path=ravendb-profiler-scripts.js
奇怪的是,我看到重複調用在這兩種情況下爲jquery.tmpl.min.js
和ravendb-profiler-scripts.js
。
的ravendb廓-scripts.js中包含行:
9. var load = function() {
10. if (options.id.length == 0)
11. return;
在隨後的負載,options.id.length爲零。模板然後不加載,並且結果不被提取。
第一頁加載包含腳本:
<script type="text/javascript">
yepnope([{ test: window.jQuery, nope: '/ravendb/profiling?path=jquery-1.6.1.min.js' }, { test: window.jQuery && window.jQuery.fn.tmpl, nope: '/ravendb/profiling?path=jquery.tmpl.min.js' }, {load: '/ravendb/profiling?path=ravendb-profiler-scripts.js', complete: function() { jQuery(function() { RavenDBProfiler.initalize({ id:['df05238a-24a6-4a16-ad63-3b9537e9b544'], url: '/ravendb/profiling' }); }) } }]);
</script>
的後續加載包含:
<script type="text/javascript">
yepnope([{ test: window.jQuery, nope: '/ravendb/profiling?path=jquery-1.6.1.min.js' }, { test: window.jQuery && window.jQuery.fn.tmpl, nope: '/ravendb/profiling?path=jquery.tmpl.min.js' }, {load: '/ravendb/profiling?path=ravendb-profiler-scripts.js', complete: function() { jQuery(function() { RavenDBProfiler.initalize({ id:[], url: '/ravendb/profiling' }); }) } }]);
</script>
注缺乏ID對象。
我也嘗試了mini-profiler,我也嘗試從最新的不穩定的RavenDb客戶端回滾到當前的穩定版本。沒有任何東西似乎有所作爲。
這是預期的行爲?我需要做其他事嗎?我在這裏是個白癡嗎?
更新
我剛剛安裝Glimpse.Ravendb插件,並報告:
剖析目前不支持EmbeddableDocumentStore。
不過,我顯然不是使用EmbeddableDocumentStore
:
public static class DocumentStoreFactory
{
public static IDocumentStore Create(string connectionStringName)
{
var documentStore = new DocumentStore { ConnectionStringName = connectionStringName };
documentStore.Initialize();
documentStore.DatabaseCommands.EnsureDatabaseExists(connectionStringName);
var catalog = new CompositionContainer(new AssemblyCatalog(typeof(Users_ByKarmaAndLocation).Assembly));
IndexCreation.CreateIndexes(catalog, documentStore.DatabaseCommands.ForDatabase(connectionStringName), documentStore.Conventions);
return documentStore;
}
}
我不知道這是否是一個紅色的鯡魚與否。我想我會提到它。
了所使用什麼連接字符串? – synhershko 2012-07-19 19:26:31
@synhershko –
Junto
2012-07-20 10:45:46
嘗試添加「http://」。如果這不起作用,你能想出步驟來複制併發送給郵件列表嗎? – synhershko 2012-07-20 15:48:17