zoukankan      html  css  js  c++  java
  • [NullReferenceException: 未将对象引用设置到对象的实例。] System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +217 System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContex

     [NullReferenceException: 未将对象引用设置到对象的实例。]
       System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +217
       System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +69
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +138
       System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +194
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87 
     
     
    .net mvcwebapi报错


    #region 不忽略axd文件的说明,线程不安全,导致程序异常
    // RouteTable.Routes is not thread - safe.This issue is because some piece of code tried to modify the RouteTable.Routes in a manner which was not thread-safe.

    //The best practice is to modify the RouteTable.Routes in the Application_Start. If you have to modify it in a way which can be accessed by multiple threads at the same time, make sure you make it in a thread-safe way.Check the example from MSDN, copied below for ease of reference:

    //using (RouteTable.Routes.GetWriteLock())
    // {
    // Route newRoute = new Route("{action}/{id}", new ReportRouteHandler());
    // RouteTable.Routes.Add(newRoute);
    // }
    //RegisterRoutes(RouteTable.Routes);

    //public static void RegisterRoutes(RouteCollection routes)
    //{
    // //忽略对.axd文件的Route,也就是和WebForm一样直接去访问.axd文件
    // routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
    // routes.MapMvcAttributeRoutes();


    //}

     
     
     
  • 相关阅读:
    【Git】为GitHub添加ssh配置
    【Linux】cmake编译指定 gcc/g++
    【Git】提交历史查看
    【AFL(十五)】LAVA-M服务器篇
    Docker实用技巧(五):查看容器占用磁盘大小
    Docker实用技巧(四):限制cpu数量
    【AFL(十四)】afl-plot 使用详解
    【AFL(十三)】afl-whatsup 使用详解
    Docker实用技巧(三):容器与主机之间的端口映射
    【AFL(十二)】make文件管理
  • 原文地址:https://www.cnblogs.com/jiamengyang/p/10658044.html
Copyright © 2011-2022 走看看