views:

810

answers:

5

hello,

i was talking with a friend about what iis does when u put a new file inside a virtual directory.

he tolds me that IIS recompile the entire website when u put a file anywhere in the website, i think it just happens (if happen) when u put a file inside your Bins folder.

the conversation comes because a website in the company is use to upload files but the files are save inside a folder name "Letters" in our website, my friend says that every time someone upload a file iis will recompile the entire website.

any help?

thanks

+2  A: 

It only recompiles when you add code that needs to be compiled. I.e. adding new classes to App_Code. It doesnt recompile when you simply save an image or text file to the website.

Adam Pope
Not exactly true. There is this little thing called Just In Time compiling. Just by running certain code you can cause it to recompile (anonymous types is a biggie)
Chris Lively
A: 

Definitely depends on your version because: There's also a new hotfix that lets you optimize compilation so IIS recompiles less often, but I'm not sure when exactly.

I THINK it used to be that new markup won't trigger a recompile if you don't navigate to it (and instead navigate to another markup file), and bin/dll/assembly files will always trigger.

Adam A
+1  A: 

I think ASP.NET only re-starts and re-compiles the whole site when bin assemblies, App_Code or global.asax are changed.

See this blog post for details of a new flag to optimize ASP.NET compilation behavior.

Adding files to a folder within the virtual directory should not lead to a re-compile (unless the folder is 'bin' or 'app_code'!)

codeulike
A: 

There is a setting in the machine.config numRecompilesBeforeApprestart which indicates the number of file changes that can occurr before the application will restart. The default is 15.

In non production environments, I usually set this much higher so you can modify aspx pages on the fly without causing the entire app to restart.

This might be what your friend is talking about.

Robin Day
yeah but can i upload things suchs as pictures or documents inside a folder and nothing will happens??
jmpena
+1  A: 

Easy enough to test. Start watching the JIT compile counters on the web server... Browser around, then drop a file in it to see the counters show.

Chris Lively
hmmm sorry... where to find the JIT Compile counters ??? :)
jmpena
run perfmon. Then add the .NET CLR Jit counters to your graph. If your app uses anonymous types or anonymous methods it's going to jump all over the place. Regardless, it will jump when the site does a recompile.
Chris Lively
fine, i did the test and "% Time in Jit" Always jump when i put or remove a file in my BIN folder, if i put or remove the file in other folder nothing happens... thanks
jmpena