ASP.NET MVC Diagnostics Using NuGet

Sometimes, despite your best efforts, you encounter a problem with your ASP.NET MVC application that seems impossible to figure out and makes you want to pull out your hair. Or worse, it makes you want to pull out my hair. In some of those situations, it ends up being a PEBKAC issue, but in the interest of avoiding physical harm, I try not to point that out.

pebkac-comic

Thankfully, in the interest of saving my hair, Brad Wilson (recently featured on This Developer’s Life!) wrote a simple diagnostics web page for ASP.NET MVC that you can drop into any ASP.NET MVC application. When you visit the page in your browser, it provides diagnostics information that can help discover potential problems with your ASP.NET application.

To make it as easy as possible to use it, I created a NuGet package named “MvcDiagnostics”. If you’re not familiar with NuGet, check out my announcement of NuGet as well as our Getting Started guide written by Tim Teebken.

With NuGet, you can use the Add Package Library Dialog to install MvcDiagnostics. Simply type in “MVC” in the search dialog to filter the online entries. Then locate the MvcDiagnostics entry and click “Install”.

add-package-dialog

Or you can use the Package Manager Gonsole and simply type:

install-package MvcDiagnostics

Either way, this will add the MvcDiagnostics.aspx page to the root of your web application.

mvcdiagnostics-viewinbrowser

You can then visit the page with your browser to get diagnostics information.

mvc-diagnostics

With NuGet, it’s much easier to make use of this diagnostics page. Hopefully you’ll rarely need to use it, but it’s nice to know it’s there. Let us know if you have ways to improve the diagnostics page.

What others have said

Requesting Gravatar... Brad Wilson Dec 05, 2010 4:05 AM
# re: ASP.NET MVC Diagnostics Using NuGet
In fairness, MvcDiagnostics was the brain-child of the brilliant but blogless Levi Broderick. I just got to document its existence. :)
Requesting Gravatar... Richard McCutchen Dec 05, 2010 4:17 AM
# re: ASP.NET MVC Diagnostics Using NuGet
Phil,

Maybe you can help me out here, when I tried install-package MvcDiagnostics in the NuGet console I got the following error:

Install-Package : [A]NuGet.Manifest cannot be cast to [B]NuGet.Manifest. Type A originates from 'NuGet.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context '
Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\NuGet.Core\v4.0_1.0.0.0__31bf3856ad364e35\NuGet.Core.dll'. Type B originates from 'NuGet.Core, Version=1.0.0.0, Culture=neutral
, PublicKeyToken=31bf3856ad364e35' in the context 'LoadFrom' at location 'C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Outercurve Foundation\NuGet Tools\0.2\NuGet.Core.
dll'.
At line:1 char:16
+ install-package <<<< MvcDiagnostics
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidCastException
+ FullyQualifiedErrorId : NuGet.VisualStudio.Cmdlets.InstallPackageCmdlet

Have any idea what's causing this and how I can resolve it? Thanks ;)
Requesting Gravatar... BlueCoder Dec 05, 2010 4:34 AM
# re: ASP.NET MVC Diagnostics Using NuGet
Just install it and run it. I enjoy working with NuGet I feel more professional !
Requesting Gravatar... Sergio Tapia Dec 05, 2010 9:11 AM
# re: ASP.NET MVC Diagnostics Using NuGet
This seems very useful. I'm going to try it out, thanks for sharing!
Requesting Gravatar... Pierrick Dec 05, 2010 11:28 AM
# re: ASP.NET MVC Diagnostics Using NuGet
Nice work! Would be nice to see a razor version too :) I guess it's not too hard to convert it!
Requesting Gravatar... Imran Dec 05, 2010 12:48 PM
# re: ASP.NET MVC Diagnostics Using NuGet
I was aware about that diagnostic page with the help of awesome Levi Broderick.
Requesting Gravatar... Ray Dec 05, 2010 11:20 PM
# re: ASP.NET MVC Diagnostics Using NuGet
I tried install-package mvcdiagnostics, but the .aspx page was never added. Any ideas?
Requesting Gravatar... Paul Dec 06, 2010 2:44 AM
# re: ASP.NET MVC Diagnostics Using NuGet
I am not seeing the MvcDiagnostics as an available package? On a side note, if you have not seen this (http://www.thewebsiteisdown.com/) watch video one. Best example of PEBKAC
Requesting Gravatar... haacked Dec 07, 2010 1:08 AM
# re: ASP.NET MVC Diagnostics Using NuGet
@Ray try it again? It worked for me.
@Paul try it again? I see it there.
Requesting Gravatar... Jason Dec 21, 2010 8:54 PM
# re: ASP.NET MVC Diagnostics Using NuGet
It's dead, Jim.

haacked.com/...
Requesting Gravatar... Vishal Patwardhan Feb 13, 2011 1:52 PM
# Routing Problem in asp.net mvc
Hi, i am using the follow routing in my asp.net mvc2

routes.MapRoute("Default", "{controller}/{action}/{id}", new {controller="Home",action="Index",id=UrlParameter.Optional});

still this is showing me directory listing but whenever i type the hardcoded url say : localhost:xxxx/Default this is showing the appropriate page. what should i Do?
Requesting Gravatar... Nay Dec 11, 2011 11:16 AM
# re: ASP.NET MVC Diagnostics Using NuGet
So this is the error I got:

An ASP.NET MVC assembly has not been loaded into this application.

Any ideas on where to go from here to get it fixed?

Thanks
Requesting Gravatar... haacked Dec 11, 2011 4:28 PM
# re: ASP.NET MVC Diagnostics Using NuGet
@Nay, that looks like you don't have ASP.NET MVC assemblies deployed to your server. Have you heard this? haacked.com/.../bin-deploying-asp-net-mvc-3.aspx

What do you have to say?

(will show your gravatar)
Please add 7 and 6 and type the answer here: