原因似乎是 ASP.Net 及其首次和回收后从应用程序目录加载程序集的方式。首次启动时,程序集从应用程序的 bin 目录加载,在回收(甚至 IIS 重新启动)后,它从应用程序的 bin 目录加载程序集。临时 ASP.NET 文件目录。并根据情况加载或多或少的程序集。
您可以通过将以下行添加到您的Application_Start
方法在你的Global.asax
protected void Application_Start()
{
Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
bool glimpseMvc3AssemblyLoaded = loadedAssemblies.Any(a => a.FullName.Contains("Glimpse.Mvc3"));
File.AppendAllText(
"C:\\temp\\output.txt",
string.Format(
"{0}{1} assemblies loaded and Glimpse.Mvc3 is{2} one of them",
Environment.NewLine,
loadedAssemblies.Length,
glimpseMvc3AssemblyLoaded ? string.Empty : " not"));
}
如果运行该命令,您将在 output.txt 文件中看到以下条目(尽管数字可能不同)
第一次初始启动时:
60 assemblies loaded and Glimpse.Mvc3 is one of them
回收后
30 assemblies loaded and Glimpse.Mvc3 is not one of them
30 assemblies loaded and Glimpse.Mvc3 is not one of them
删除里面对应的目录后临时 ASP.NET 文件目录
70 assemblies loaded and Glimpse.Mvc3 is one of them
这与一瞥有何关联。 Well Glimpse 拨打电话AppDomain.Current.GetAssemblies()
之后它将寻找实现的类型ITab
,但如果Glimpse.Mvc3
未返回程序集,则不会发现其中定义的选项卡,因此不会显示。
这能解决您的问题吗?恐怕不是,但我认为最好继续讨论一瞥问题跟踪器 https://github.com/glimpse/glimpse/issues,事实上我已经找到了类似问题 https://github.com/Glimpse/Glimpse/issues/462在那儿,但我不确定它是不是你的。
Update即将发布的 Glimpse 版本中将会有一个修复程序,但同时有一个解决方案/解决方法,如中所述评论之一 https://github.com/Glimpse/Glimpse/issues/462#issuecomment-21168158关于一瞥问题。
只需将以下语句添加到全局.asax Application_Start
method
BuildManager.GetReferencedAssemblies()
and 你可以走了 https://github.com/Glimpse/Glimpse/issues/462#issuecomment-21170223