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.
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.