gpt4 book ai didi

c# - [ASP.net]MVC 在我的 Controller 之前做什么?

转载 作者:太空狗 更新时间:2023-10-29 21:58:00 25 4
gpt4 key购买 nike

我的 MVC Controller 出现了一些奇怪的性能问题,或者更确切地说是在它之前?

根据 Mini Profiler 输出,在到达我的 Controller 之前有 120 毫秒的开销。

有人知道为什么会这样吗?这是在服务器上(非本地),设置了 Compilation debug=false,所以这不是在 release 模式下运行的问题。

它之后的所有内容,我都可以调整/修改,但之前呢?我迷路了..

想法??

enter image description here

更新

在一些性能工具之后,我遇到了 enter link description here & enter link description here结果如下:

Most expensive stacks ------------------------------------ System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute System.Web.HttpApplication.ExecuteStep System.Web.HttpApplication+PipelineStepManager.ResumeSteps System.Web.HttpApplication.BeginProcessRequestNotification System.Web.HttpRuntime.ProcessRequestNotificationPrivate System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper System.Web.Hosting.PipelineRuntime.ProcessRequestNotification System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper System.Web.Hosting.PipelineRuntime.ProcessRequestNotification ===> Cost (1716011)

Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp Microsoft.Practices.Unity.UnityContainer.DoBuildUp Microsoft.Practices.Unity.UnityContainer.DoBuildUp System.Web.Mvc.DefaultControllerFactory+DefaultControllerActivator.Create System.Web.Mvc.DefaultControllerFactory.CreateController System.Web.Mvc.MvcHandler.ProcessRequestInit System.Web.Mvc.MvcHandler+<>c__DisplayClass6.b__2 System.Web.Mvc.SecurityUtil+<>c__DisplayClassb`1.b__a System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute System.Web.HttpApplication.ExecuteStep System.Web.HttpApplication+PipelineStepManager.ResumeSteps System.Web.HttpApplication.BeginProcessRequestNotification System.Web.HttpRuntime.ProcessRequestNotificationPrivate System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper System.Web.Hosting.PipelineRuntime.ProcessRequestNotification System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper System.Web.Hosting.PipelineRuntime.ProcessRequestNotification ===> Cost (936006)

Microsoft.Win32.Win32Native.CoCreateGuid StackExchange.Profiling.Timing..ctor StackExchange.Profiling.MVCHelpers.ProfilingViewEngine.Find System.Web.Mvc.ViewEngineCollection+<>c__DisplayClassc.b__a System.Web.Mvc.ViewEngineCollection.Find System.Web.Mvc.ViewEngineCollection.Find System.Web.Mvc.ViewResult.FindView System.Web.Mvc.ViewResultBase.ExecuteResult System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1c.b__19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters System.Web.Mvc.ControllerActionInvoker.InvokeAction System.Web.Mvc.Controller.ExecuteCore System.Web.Mvc.ControllerBase.Execute System.Web.Mvc.MvcHandler+<>c__DisplayClass6+<>c__DisplayClassb.b__5 System.Web.Mvc.Async.AsyncResultWrapper+<>c__DisplayClass1.b__0 System.Web.Mvc.MvcHandler+<>c__DisplayClasse.b__d System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute System.Web.HttpApplication.ExecuteStep System.Web.HttpApplication+PipelineStepManager.ResumeSteps System.Web.HttpApplication.BeginProcessRequestNotification System.Web.HttpRuntime.ProcessRequestNotificationPrivate System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper System.Web.Hosting.PipelineRuntime.ProcessRequestNotification System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper System.Web.Hosting.PipelineRuntime.ProcessRequestNotification ===> Cost (780005)

unity 会导致一些问题吗?

最佳答案

你应该看看The ASP.NET MVC Pipeline

ASP.NET MVC Pipeline可以分为以下几个部分-

  • 应用程序初始化 - 在此方法中,您可以将 Route 对象添加到静态 RouteTable.Routes 集合(属于 RouteCollection 类型)。

  • 路由部分 – 路由模块尝试将传入的 URL 与路由表,并调用相应的IRouteHandler。

  • Controller 创建 – IControllerFactory 创建一个实例基于路由参数和默认命名的 Controller 约定。

  • Action Execution – IActionInvoker 标识要执行的方法执行时,IModelBinder 验证并绑定(bind)方法参数IFilterProvider 发现要应用的过滤器。那个行动返回类型 ActionResult。

  • View – IViewEngine 实例化正确的 View 引擎和模型传递给 View 。使用模型验证提供程序,检索验证规则以创建客户端验证脚本以及远程验证脚本

更多信息:

http://blog.stevensanderson.com/2007/11/20/aspnet-mvc-pipeline-lifecycle/

关于c# - [ASP.net]MVC 在我的 Controller 之前做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21002480/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com