Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

c# - Slow Performance -- ASP .NET ASPNET_WP.EXE and CSC.EXE Running After Clicking Redirect Link

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. I'm trying to track down why it takes so long to load the page.

The page hosts two other custom controls.

I have commented out the lines of code for each and both controls, and the page still takes about 30 seconds to load.

I've set breakpoints on the Page_Load event for each of the controls as well as page.aspx and it also takes about 30 seconds from clicking the link with the Response.Redirect to the first break point.

I loaded up task manager and clicked on the link. I notice aspnet_wp.exe and csc.exe run during this 30 second time frame.

I'm wondering if there are some sort of code-behind shinanigans going on while I'm waiting for the page to load.

This only occurs the first time I click on the link. Afterwards, it's not as slow.

I've googled but there's not a lot of useful information about this. Anyone have any ideas?

Thanks,

---Dan---

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...