ASP.Net MVC中的尾随斜杠问题

时间:2017-03-08 13:55:28

标签: asp.net asp.net-mvc iis

当我尝试访问这样的应用程序时,我在本地IIS(10)上托管了一个MVC 5应用程序:

  

http://localhost/TS.Loyalty.UI.Web

它抛出此异常

  

[NullReferenceException:对象引用未设置为的实例   对象。]
  System.Web.Mvc.AuthorizeAttribute.AuthorizeCore(HttpContextBase   httpContext)+30
  System.Web.Mvc.AuthorizeAttribute.OnAuthorization(AuthorizationContext   filterContext)+160
  System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext   controllerContext,IList 1 filters, ActionDescriptor actionDescriptor) +97 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState) +743
System.Web.Mvc.Async.WrappedAsyncResult
1.CallBeginDelegate(AsyncCallback   callback,Object callbackState)+14
  System.Web.Mvc.Async.WrappedAsyncResultBase 1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +343
System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +25
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallBeginDelegate(的AsyncCallback   callback,Object callbackState)+30
  System.Web.Mvc.Async.WrappedAsyncResultBase 1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +465
System.Web.Mvc.Controller.<BeginExecute>b__14(AsyncCallback asyncCallback, Object callbackState, Controller controller) +18
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallBeginDelegate(的AsyncCallback   callback,Object callbackState)+20
  System.Web.Mvc.Async.WrappedAsyncResultBase 1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +374
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +16
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +52 System.Web.Mvc.Async.WrappedAsyncVoid
1.CallBeginDelegate(的AsyncCallback   callback,Object callbackState)+30
  System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback的   回调,对象状态,Int32超时)+128
  System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase   httpContext,AsyncCallback回调,对象状态)+384
  System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext,   AsyncCallback回调,对象状态)+48
  System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext的   context,AsyncCallback cb,Object extraData)+16
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   +103 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+155

但是,如果我试图用这样的斜杠访问它:

  

http://localhost/TS.Loyalty.UI.Web/

完美无缺

  

注意::我不想像IIS中的URL重写那样解决方法,我只是想知道为什么会发生这种情况发生在我的应用程序中

     

注意::我在本地IIS上托管了另一个应用程序,它运行良好

0 个答案:

没有答案