ASP.NET MVC Route Debugger: One handy tool

I really enjoy the ASP.NET MVC Route Debugger that Phil Haack wrote. It’s even cooler now that it’s deployed as a NuGet package.

I was having trouble getting error redirection working in an ASP.NET MVC site deployed on Azure.  I could not figure out why I could still get to the yellow screen of death.

I added the route debugger, and the answer was quickly obvious. I’d forgotten an Index method on my ErrorController class. I added that method, redirecting to my error page method, and all was great. I turned off the route debugger in web.config and deployed to Azure.

It didn’t work at all!

I’d originally written the site using MVC 2, and the route debugger needed a new version of ASP.NET MVC (which was installed on my developer box.) To fix the problem, I needed to deploy the latest version of ASP.NET MVC in Azure along with my site. There are a fewposts that explain how you can do this.  However, for ASP.NET MVC now, there is an easier way. Right-click on the web site node in Solution Explorer, and select “Add Deployable Dependencies”.  You’ll see the following dialog:



Just check both boxes, and the add in configures a _bin_deployableAssemblies directory with everything you need. I deployed this version to Azure, and everything is fine. I can modify my web.config online and see any route errors either on the Azure fabric, or locally.

When you’re working in Azure, you need to remember that you almost certainly won’t have the same environment you have on your local box. You’ll be missing dependencies. You need to manage those when you first deploy to Azure. You may be missing things.

Created: 8/17/2011 7:33:54 PM

Current Projects

I create content for .NET Core. My work appears in the .NET Core documentation site. I'm primarily responsible for the section that will help you learn C#.

All of these projects are Open Source (using the Creative Commons license for content, and the MIT license for code). If you would like to contribute, visit our GitHub Repository. Or, if you have questions, comments, or ideas for improvement, please create an issue for us.

I'm also the president of Humanitarian Toolbox. We build Open Source software that supports Humanitarian Disaster Relief efforts. We'd appreciate any help you can give to our projects. Look at our GitHub home page to see a list of our current projects. See what interests you, and dive in.

Or, if you have a group of volunteers, talk to us about hosting a codeathon event.