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();


    //}

     
     
     
  • 相关阅读:
    day40_jQuery学习笔记_01
    jQuery选择什么版本 1.x? 2.x? 3.x?
    6个关于dd命令备份Linux系统的例子
    快速掌握grep命令及正则表达式
    Linux下删除乱码或特殊字符文件
    在 Linux 中永久修改 USB 设备权限
    CentOS 7 中 hostnamectl 的使用
    申请红帽企业版Linux开发者订阅
    CentOS6 下rsync服务器配置
    Centos6下DRBD的安装配置
  • 原文地址:https://www.cnblogs.com/jiamengyang/p/10658044.html
Copyright © 2011-2022 走看看