Hi all, As we all know, when a .cshtml(view) file is modified, asp.net mvc compiles automatically when first user visit the website, however I'm trying to find a solution to prevent automatic compiling. My site PV is very high, so when I update the website(only update .cshtml) every time, the performance of the whole site becomes very bad, and this causes very bad user experience. Is there any good suggestions to solve this problem, many thanks!
You can use compiled view but how far it will help is the question, I see your site will not compile the view but it will still reset the app pool after the deployment.
You need to see the update should not happen very frequently and it should happen only during downtime.
it will still re-compile when I update the views project-dll, isn't it? the question is the view will be updated very frequently. 100 times per day on average.
it will still re-compile when I update the views project-dll, isn't it? the question is the view will be updated very frequently. 100 times per day on average.
You need to store your dynamic content in a database and dynamically render it into your page then. As others have said, the dynamic compliation model is not designed for updates of this frequency.
actually not so frequently, about 10-40 times per day, that's application is for subject pages
only, editors publish subjects to that website, usually 10-30 new subjects per day. and sometimes existed projects will be edited.
actually,a subject is a cshtml in View folder. so, views need to be updated frequently the same as the subject.
I'm wondering where causes the low performace? the process of re-compile the cshtml, or the process of the app-pool reset? and which one is longer?
I know that update the view causes the folder recompiled, will this compiling process influence other folders? for example:
I updated a.cshtml in folder A, all files in A folder will be recompiled, during the compiling process, if someone visit views in folder B, will he be influenced? if not, I'd like to split the views into more folders, thus it can minimaze the influence..
actually not so frequently, about 10-40 times per day, that's application is for subject pages only, editors publish subjects to that website, usually 10-30 new subjects per day. and sometimes existed projects will be edited.
actually,a subject is a cshtml in View folder. so, views need to be updated frequently the same as the subject.
I think you are after content managed site and not views, for your site view shouldn't be changing very often but the content on the page. Try looking for some content management sw and see how they integrate with your MVC App.
wnfk
I'm wondering where causes the low performace? the process of re-compile the cshtml, or the process of the app-pool reset? and which one is longer?
wnfk
0 Points
4 Posts
prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 12, 2012 01:54 AM|LINK
Hi all,
As we all know, when a .cshtml(view) file is modified, asp.net mvc compiles automatically when first user visit the website, however I'm trying to find a solution to prevent automatic compiling.
My site PV is very high, so when I update the website(only update .cshtml) every time, the performance of the whole site becomes very bad, and this causes very bad user experience.
Is there any good suggestions to solve this problem, many thanks!
ignatandrei
All-Star
135073 Points
21662 Posts
Moderator
MVP
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 12, 2012 04:20 AM|LINK
you can compile views in a separate project
http://razorgenerator.codeplex.com/
CPrakash82
All-Star
18284 Points
2841 Posts
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 12, 2012 02:09 PM|LINK
You can use compiled view but how far it will help is the question, I see your site will not compile the view but it will still reset the app pool after the deployment.
You need to see the update should not happen very frequently and it should happen only during downtime.
wnfk
0 Points
4 Posts
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 13, 2012 12:58 AM|LINK
it will still re-compile when I update the views project-dll, isn't it? the question is the view will be updated very frequently. 100 times per day on average.
wnfk
0 Points
4 Posts
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 13, 2012 01:03 AM|LINK
Even the views are compiled in advance.. it sill reset the app poll after the deployment. Yes, that's the question...
I'm afraid asp.net mvc is not for frequently updated website.
ignatandrei
All-Star
135073 Points
21662 Posts
Moderator
MVP
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 13, 2012 03:01 AM|LINK
Nope.
Wow. What kind of application need this?
ignatandrei
All-Star
135073 Points
21662 Posts
Moderator
MVP
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 13, 2012 03:03 AM|LINK
Yes.
What number is "frequently"? Do you need more than 1 -2 times a month (after the developers/designers finishes their jobs)?
BrockAllen
All-Star
27534 Points
4907 Posts
MVP
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 13, 2012 07:24 PM|LINK
You need to store your dynamic content in a database and dynamically render it into your page then. As others have said, the dynamic compliation model is not designed for updates of this frequency.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
wnfk
0 Points
4 Posts
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 14, 2012 02:15 AM|LINK
Thanks again for all your help...
actually,a subject is a cshtml in View folder. so, views need to be updated frequently the same as the subject.
I'm wondering where causes the low performace? the process of re-compile the cshtml, or the process of the app-pool reset? and which one is longer?
I know that update the view causes the folder recompiled, will this compiling process influence other folders? for example:
I updated a.cshtml in folder A, all files in A folder will be recompiled, during the compiling process, if someone visit views in folder B, will he be influenced? if not, I'd like to split the views into more folders, thus it can minimaze the influence..
let me try it...
CPrakash82
All-Star
18284 Points
2841 Posts
Re: prevent asp.net mvc3 compiling the whole site when modifying a cshtml file
Nov 14, 2012 02:21 AM|LINK
I think you are after content managed site and not views, for your site view shouldn't be changing very often but the content on the page. Try looking for some content management sw and see how they integrate with your MVC App.
App Pool.