Remove Extra View Engines : Thanks to @Glimpse

Note: Some developers may knew this already but if you do not then read it because it will be used to increase your performance.

First of all what is View Engine?
The view engine is responsible for creating HTML from your views. Views are usually some kind of mixup of HTML and a programming language.

And what is Glimpse?
Glimpse is a web debugging and diagnostics tool used to gain a better understanding of whats happening inside of your ASP.NET application.

How to get Glimpse?
To install Glimpse, run the following command in the Package Manager Console :-

 glimpse_views_viewengine_partial (1)

Will it start automatically?
Well no, after downloading you need to turn Glimpse On.

Run the app, navigate below Url  :
http://localhost:54449/glimpse.axd ////Your port number instead of 54449

now turn Glimpse On as shown in below images.


Ok, got it but what is the problem?
When you download Glimpse and run your application you will see below bar.


Now look closely, Let me zoom it for you:


You will see that it is looking for the razor and aspx files to all the possible locations. But as we know that we are using razor view engine so it should not waste time in looking other aspx files because we already know that it is not going to be part of solution.

Will it affect the performance?
It surely does. If you have big project then it will surely slow down the application and it directly decreases the performance,

Ohh! What is the solution then?
The solution is as shown below:

You can add this in global.asax Application_Start.

public void Application_Start()
     // Clears all previously registered view engines.
     ViewEngines.Engines.Add(new RazorViewEngine());

Yes, it will only allow Razor as your view engine.

But wait there is a catch! We only need “cshtml” files right?

So here we go:

public void Application_Start()

     IViewEngine razorEngine = new RazorViewEngine() 
         FileExtensions = new string[] { "cshtml" } 


You will surely see nice improvement after this piece of code mainly when you have a big project.

In the end some links to redirect you to something awesome which is Glimpse.



Step by step process to install:


Stay tuned for more updates!


8 thoughts on “Remove Extra View Engines : Thanks to @Glimpse

  1. Simply desire to say your article is as astounding.
    The clearness in your post is just cool and i
    could assume you are an expert on this subject.

    Fine with your permission let me to grab your feed to keep updated with forthcoming
    post. Thanks a million and please carry on the rewarding work.


  2. Hiya, I am really glad I have found this info. Today bloggers publish only about gossips and internet and this is actually frustrating. A good web site with exciting content, that is what I need. Thanks for keeping this site, I will be visiting it. Do you do newsletters? Cant find it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s