资源描述:
《【毕业设计】文献翻译原文译文(探究asp--mvc请求的生命周期)》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、ASP.NETMVCIn-Depth:TheLifeofanASP.NETMVCRequestThepurposeofthisblogentryistodescribe,inpainfuldetail,eachstepinthelifeofanASP.NETMVCrequestfrombirthtodeath.IwanttounderstandeverythingthathappenswhenyoutypeaURLinabrowserandhittheenterkeywhenrequestingap
2、agefromanASP.NETMVCwebsite.WhydoIcare?Therearetworeasons.First,oneofthepromisesofASP.NETMVCisthatitwillbeaveryextensibleframework.Forexample,you’llbeabletoplugindifferentviewenginestocontrolhowyourwebsitecontentisrendered.Youalsowillbeabletomanipulateh
3、owcontrollersgetgeneratedandassignedtoparticularrequests.IwanttowalkthroughthestepsinvolvedinanASP.NETMVCpagerequestbecauseIwanttodiscoveranyandalloftheseextensibilitypoints.Second,I’minterestedinTest-DrivenDevelopment.Inordertowriteunittestsforcontrol
4、lers,Ineedtounderstandallofthecontrollerdependencies.Whenwritingmytests,IneedtomockcertainobjectsusingamockingframeworksuchasTypemockIsolatororRhinoMocks.IfIdon’tunderstandthepagerequestlifecycle,Iwon’tbeabletoeffectivelymockit.TwoWarningsButfirst,twow
5、arnings.Here'sthefirstwarning:I’mwritingthisblogentryaweekaftertheASP.NETMVCPreview2waspubliclyreleased.TheASP.NETMVCframeworkisstillverymuchinBeta.Therefore,anythingthatIdescribeinthisblogentrymightbeoutdatedand,therefore,wronginacoupleofmonths.So,ify
6、ouarereadingthisblogentryafterMay2008,don’tbelieveeverythingyouread.Second,thisblogentryisnotmeantasanoverviewofASP.NETMVC.IdescribethelifecycleofanASP.NETMVCrequestinexcruciatinganddifficulttoreaddetail.Okay,youhavebeenwarned.OverviewoftheLifecycleSte
7、psTherearefivemainstepsthathappenwhenyoumakearequestfromanASP.NETMVCwebsite:Step1:TheRouteTableisCreatedWhenyourequestapagefromanormalASP.NETapplication,thereisapageondiskthatcorrespondstoeachpagerequest.Forexample,ifyourequestapagenamedSomePage.aspxth
8、entherebetterbeapagenamedSomePage.aspxsittingonyourwebserver.Ifnot,youreceiveanerror.Technically,anASP.NETpagerepresentsaclass.And,notjustanyclass.AnASP.NETpageisahandler.Inotherwords,anASP.NETpageimplementstheIHttpHandlerinterfaceandha