Search code examples
asp.net-mvcentity-frameworkglimpse

Disable Glimpse completely


Let's say I want to completely disable Glimpse.

Glimpse now registers itself using the assembly activation method. So even if I comment out all the glimpse stuff in web.config, it will still try to load.

I prefer to manually register Glimpse in Application_Start, if I need it.

Is there any way to override the default behavior to allow me to register it manually? (Which means I can disable it completely if I need to.)


Solution

  • Glimpse has been built around the philosophy to have it run with the least amount of additional config or code for users to add or write themselves. Granted this comes with the additional drawback that if you want to disable it completely, that changes from your side will be required and some changes are easier than others.

    I answered a similar SO Question Why is Glimpse still running indicating why commenting Glimpse specific config inside web.config is not enough for assemblies using the PreApplicationStartMethodAttribute.

    In short, you'll need to make sure that the Glimpse.EF* and the Glimpse.Ado assemblies are not deployed in addition to commenting your web.config. Not deploying these assemblies and commenting out those config sections can be automated one way or the other (web.config transformations, custom build tasks...)