仅在制作中,当用户点击我们的登录屏幕时,我们会收到以下elmah eror
System.NullReferenceException: Object reference not set to an instance of an object.
Generated: Wed, 24 Apr 2013 16:50:35 GMT
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext)
at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context)
at System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
不幸的是,没有很多东西可以给我任何提示!
我的猜测是在某种情况下,这种情况下的路线在尝试使用时还没有完成......但这只是猜测。
之前有没有人见过这个错误?
我们正在使用GlobalAsax Begine Request方法加载路径。
protected void Application_BeginRequest()
{
if(RouteTable.Routes.Count == 0) {
XmlConfigurator.Configure();
ILog log = LogManager.GetLogger("MainLog");
log.Info("Logger started");
//AreaRegistration.RegisterAllAreas();
//log.Info("RegisterAllAreas done");
RegisterRoutes(RouteTable.Routes);
log.Info("RegisterRoutes done");
try
{
BootstrapStuctureMap.Bootstrap();
log.Info("Done Bootstrapping");
BootStrapAutoMapper.Configure();
log.Info("Done Automapping");
}
catch (Exception ex)
{
log.Error("Error in Application_Start: ex = " + ex);
throw;
}
ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory());
log.Info("Done Building StructureMapControllerFactory");
ModelBinders.Binders.DefaultBinder = new CustomModelBinder();
ModelMetadataProviders.Current = new AnnotationsAndConventionsBasedModelMetaDataProvider();
}
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("elmah.axd");
// you have to add this IgnoreRoute so that the PDFX pages get handled like a regular *.aspx page, not a MVC page. - EWB
routes.IgnoreRoute("{resource}.pdfx");
routes.IgnoreRoute("{*favicon}", new {favicon = @"(.*/)?favicon.ico(/.*)?"});
routes.MapRoute("StudentLookup_Return",
"StudentLookup/StudentLookup/{nextAction}/{nextController}",
new
{
controller = "StudentLookup",
action = "StudentLookup"
}
);
routes.MapRoute("StudentLookup_Id",
"StudentLookup/StudentLookup/{Id}",
new
{
controller = "StudentLookup",
action = "StudentLookup",
Id = UrlParameter.Optional
}
);
routes.MapRoute("Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional
} // Parameter defaults
);
}
我们相信它是在一些新的服务器在线购买之后出现的,所以它可能与这些服务器的配置方式有关。
我有点在这里扔一个冰雹玛丽,以前有人见过这个,并想出来了!
非常感谢任何帮助。