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 :-
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.Clear(); 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() { ViewEngines.Engines.Clear(); IViewEngine razorEngine = new RazorViewEngine() { FileExtensions = new string[] { "cshtml" } }; ViewEngines.Engines.Add(razorEngine); }
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.
Website: http://getglimpse.com/
Documentation: http://getglimpse.com/Docs/
Step by step process to install: http://getglimpse.com/Docs/Installing
Github: https://github.com/Glimpse
Stay tuned for more updates!
. .
LikeLike
Excellent post! We are linking to this great content on our website.
Keep up the great writing.
LikeLike
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.
LikeLike
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.
LikeLike
Love the website– very user friendly and whole lots to see!|
LikeLike
I am impressed, I need to say. cool insight. Nice posts.
LikeLike
Great work, keep it up. I like your style.
LikeLike
Great work, keep it up. Well written! I found this on Pinterest I have added your website to my Tumblr bookmarks This really answered my problem.
LikeLike