Slow Performance — ASP .NET ASPNET_WP.EXE and CSC.EXE Running After Clicking Redirect Link

后端 未结 2 1008
清歌不尽
清歌不尽 2020-12-11 09:55

I click on a link from one page that does a redirect to another page (Response.Redirect(page.aspx)).

The browser churns for about 30 seconds and the page displays.

相关标签:
2条回答
  • 2020-12-11 10:11

    The very first time that the page is load, then the asp.net compile a lot of pages, almost every one found on the same dir, including modules, and dlls found on bin.

    To speed up (your development) try use this option on web.config (only on your development computer).

    <compilation batch="false" ... >
    

    Using batch="false" asp.net compiles only one page, the one you are on it, so you get a big time the first time for the dlls, but after that, is a lot less if you have 200 pages, and you only change one, and you develop/debug only one.

    Also if you can, try do not use App_Code directory, and place all your code inside a dll. Look more about compilation options on web.config to make it even run faster, change for example the temporary directory to a faster different disk than the C:.

    Second trick

    I will like to say one more trick that I found here on stackoverflow.

    <compilation optimizeCompilations="true">
    

    You only need to have install an ms patch http://support.microsoft.com/kb/961884 I have test it and the results are very good.

    .net 4 and Visual studio 2010

    The same think stands, but you do not need to run the patch.

    Web Farm

    I have notice that on web farm the first time that application is run, if you have many work on global.asax on application start, then I recoment to use Mutex and let only one pool make the compile of the pages ! Or else there are possibilities for conflicts and huge delay to start the application - especial if you use mutex on other part of the program.

    0 讨论(0)
  • 2020-12-11 10:29

    The fact that csc.exe is running and it only occurs when you first click the link would suggest there are a lot of elements in the aspx that need to be compiled prior to displaying the page. Look for stuff that exists in expression holes <%= %>. It could also be something in the controls themselves (particularly if they are ascx user controls and not server controls).

    The reason it only happens the first time you click on the link is because after that the compiled page object is cached, so there is no need to re-compile until your app is restarted.

    0 讨论(0)
提交回复
热议问题