ek_ny
ek_ny

Reputation: 10243

Changing Razor View Seems to Restart My Application

It appears to me that a simple change to a .cshmtl file in my application restarts the application. Honestly I'm not sure it's restarting, but it is painfully slow when I am reloading the page. Does this seem normal? Anyone have any advice to figure out why this might be happening? It makes development a real drag.

I feel like I have time to get up and get a cup of coffee and a cigarette every time I make a change. And I don't even smoke! If this continues, I might have to take up smoking.

Upvotes: 4

Views: 556

Answers (2)

jloper
jloper

Reputation: 49

There are so many threads related to Session loss, Cache loss and Application restart. The reason for all of these is that IIS [and yes IISExpress] will restart the app pool when anything in the BIN folder changes. MVC will compile the Razor views of an application on demand. This view compilation will update the BIN folder. The update to the BIN folder will reset the app pool. This clears session and clears cache, and call Application_End.

Upvotes: -1

dknaack
dknaack

Reputation: 60556

If you change your View the Application should not restart. But it takes some time cause your View gets compiled before rendered.

You can set a breakpoint on the Application_Start() method in global.asax to see if your Application gets restarted.

Upvotes: 4

Related Questions