Application_BeginRequest和MVC Controller构造函数之间花费的时间太长 [英] Time taken between Application_BeginRequest and MVC Controller constructor is too long

查看:110
本文介绍了Application_BeginRequest和MVC Controller构造函数之间花费的时间太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC页面请求,它在Application_BeginRequest和Application_EndRequest之间花费1200毫秒。

I have an MVC page request that takes 1200ms between Application_BeginRequest and Application_EndRequest.

这段时间的大部分时间在Application_BeginRequest和MVC控制器的构造函数之间-900毫秒

The bulk of this time is between the Application_BeginRequest and the constructor of the MVC controller - 900ms.

我正在使用Unity作为依赖项注入程序和EF。控制器在构造函数上传递了12个存储库。

I am using Unity as the dependency injector and EF. The controller has 12 repositorys passed in on the constructor.

07:26:40,260 - context_BeginRequest
07:26:40,260 - Application_BeginRequest
07:26:41,180 - Constructor
07:26:41,180 - OnAuthentication
07:26:41,196 - OnAuthentication
07:26:41,321 - OnActionExecuted
07:26:41,352 - OnResultExecuted
07:26:41,352 - EndExecuteCore
07:26:41,352 - EndExecute
07:26:41,399 - Application_EndRequest


推荐答案

我建议使用 http://structuremap.github.io/ ..速度更快,功能更多。如果您在第一次调用中没有使用12个存储库,则以后可以在需要时轻松获取对象

I would recommend using http://structuremap.github.io/ .. it is more faster and has more features. if you are not using the 12 respos in your first call, you can get object later easily when you need it

Factory.GetInstance(passedInType)

这篇关于Application_BeginRequest和MVC Controller构造函数之间花费的时间太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆