I am using Castle Windsor to manage controller instances (among other things). My controller factory looks like this:
public class WindsorControllerFactory : Def
It turns out that the second request was the MVC framework trying to find a script I included in the Site.Master. The path did not exist, so I guess it tried to resolve a controller (that matched /Scripts/sitescripts.js). I changed the method to this:
protected override IController GetControllerInstance(Type controllerType)
{
if (controllerType != null)
{
return (IController)_container.Resolve(controllerType);
}
else
{
return base.GetControllerInstance(controllerType);
}
}
And an exception with an understandable message was thrown.