管窥MVC3 DLL被“遗忘”的应用程序池回收的一部分 [英] Glimpse MVC3 DLL being 'forgotten' as part of Application Pool recycle

查看:120
本文介绍了管窥MVC3 DLL被“遗忘”的应用程序池回收的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在试图获得掠影起来,在我们的环境中运行,但跨一个奇怪的问题来了。

We're trying to get Glimpse up and running in our environment but coming across a strange problem.

我们已经安装了Glimpse.Core,Glimpse.AspNet和Glimpse.Mvc3.dll当我们配置的web.config使掠影一切正常的直到应用程序池回收的。一旦程序池回收,这是因为如果该网站忘记关于Glimpse.Mvc3.dll和MVC3标签(执行,模型,元数据)消失。

We've installed Glimpse.Core, Glimpse.AspNet, and Glimpse.Mvc3.dll and when we configure web.config to enable Glimpse everything works fine until the Application Pool recycles. Once the AppPool recycles, it's as if the site 'forgets' about Glimpse.Mvc3.dll and the Mvc3 tabs (Execution, Model, Metadata) disappear.

下面是具体步骤(我们)重现:

Here are the steps (for us) to reproduce:


  1. 修改web.config中包括掠影配置

  2. 所有标签将显示,包括执行,元数据和模型绑定

  3. 执行应用程序池回收

  4. 的MVC3一瞥标签将不再显示(但其他人会)

在此之前的程序池回收,Glimpse.axd显示以下注册标签:

Prior to the AppPool recycle, Glimpse.axd shows the following Registered Tabs:


  • Glimpse.AspNet(1.3.1)

    • 配置 - Glimpse.AspNet.Tab.Configuration

    • 环境 - Glimpse.AspNet.Tab.Environment

    • 请求 - Glimpse.AspNet.Tab.Request

    • 路线 - Glimpse.AspNet.Tab.Routes

    • 服务器 - Glimpse.AspNet.Tab.Server

    • 会话 - Glimpse.AspNet.Tab.Session


    • 时间轴 - Glimpse.Core.Tab.Timeline

    • 跟踪 - Glimpse.Core.Tab.Trace


    • 执行 - Glimpse.Mvc.Tab.Execution

    • 元数据 - Glimpse.Mvc.Tab.Metadata
    • 模型绑定 - Glimpse.Mvc.Tab.ModelBinding

    • 查看 - Glimpse.Mvc.Tab.Views

    和后程序池回收,Glimpse.axd显示以下注册标签:

    And post AppPool recycle, Glimpse.axd shows the following Registered Tabs:


    • Glimpse.AspNet(1.3.1)

      • 配置 - Glimpse.AspNet.Tab.Configuration

      • 环境 - Glimpse.AspNet.Tab.Environment

      • 请求 - Glimpse.AspNet.Tab.Request

      • 路线 - Glimpse.AspNet.Tab.Routes

      • 服务器 - Glimpse.AspNet.Tab.Server

      • 会话 - Glimpse.AspNet.Tab.Session


      • 时间轴 - Glimpse.Core.Tab.Timeline

      • 跟踪 - Glimpse.Core.Tab.Trace

      这是因为如果该网站是忘记了关于Glimpse.Mvc3.dll作为程序池回收的一部分。

      It's as if the site is 'forgetting' about Glimpse.Mvc3.dll as part of the AppPool recycle.

      任何意见/建议大大AP preciated。

      Any ideas/suggestions greatly appreciated.

      推荐答案

      的原因似乎是ASP.Net和加载组件从首次应用程序目录和循环后的方式。第一次启动时,该组件从应用程序的bin目录加载和循环(甚至是IIS启动)之后它加载从 ASP.NET临时文件的目录中的组件。并且根据情况或多或少集被加载

      The reason seems to be ASP.Net and the way it loads assemblies from your application directory for the first time and after a recycle. On first start, the assemblies are loaded from your application's bin directory and after a recycle (or even an IIS restart) it loads the assemblies from the Temporary ASP.NET Files directory. And depending on the situation more or less assemblies are loaded.

      您可以通过添加以下行到你的的Application_Start 方法在的Global.asax <看到自己/ p>

      You can see this for yourself by adding the following lines to your Application_Start method in your 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的以下条目(虽然数量可能不同)

      If you run that then you will see the following entries in your output.txt file (although numbers may differ)

      在第一次初始启动:

      60集装和Glimpse.Mvc3就是其中之一

      在再循环

      30组件加载,Glimpse.Mvc3是不是其中之一

      30组件加载,Glimpse.Mvc3是不是其中之一

      取出里面相应的目录后的 ASP.NET临时文件的目录

      After removing the corresponding directory inside the Temporary ASP.NET Files directory

      70集装和Glimpse.Mvc3就是其中之一

      如何与相关一瞥。那么掠影使得以 AppDomain.Current.GetAssemblies()的调用后,它会寻找那些实施 ITAB 类型,但如果没有,则返回的 Glimpse.Mvc3 装配标签里面也不会被发现,因此没有显示定义。

      How does this correlate with Glimpse. Well Glimpse makes a call to AppDomain.Current.GetAssemblies() after which it will look for types that implement ITab, but if the Glimpse.Mvc3 assembly isn't returned then tabs defined inside of it won't be discovered and hence not shown.

      这是否解决您的问题?恐怕不行,但我觉得这是更好地继续在一瞥问题跟踪这个讨论作为事实上我已经找到了类似的问题那边,但我不知道这是否是你的。

      Does this solve your issue? I'm afraid not, but I think it is better to continue this discussion on the glimpse issue tracker, as a matter of fact I already found a similar issue over there, but I'm not sure if it is yours.

      更新
      将有掠影的即将发布的一个修复,但同时有一个解决方案/变通方法,如在的的意见之一的一瞥问题。

      只需将下面的语句添加到的Global.asax 的Application_Start

      Simply add the following statement to the Global.asax Application_Start method

      BuildManager.GetReferencedAssemblies()

      BuildManager.GetReferencedAssemblies()

      你去好

      这篇关于管窥MVC3 DLL被“遗忘”的应用程序池回收的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆