I have seen some strange behaviour that could be related to StaticFileHandler in R2, too. Several developers working with CSS changes report that when they refresh in the browser all layout disappear.
Network analysis shows that the webserver just drops the connection when you request the css-file but other files and dynamic pages continues to work without any problem. I have not found a cause or a reproducible scenario and an iisreset solves the issue.
What is the content of your staticFileHanlder tag in your web.config? Have you changed it from default configuration that caches static files for 12 hours?
1) Are you running IIS 7 ?
2) Could you try to change the staticFile to someting like this so that you force cacheControl to private. You must change all instances of staticFile where you have a non-negative value on expirationTime. Does this solve your problem ?
<staticFile expirationTime="1.0:0:0" cacheControl="private" />
Im also experiencing the same problems with EPiServerStaticFileHandler with R2. Im developing on an R2 release on Windows XP.
We're getting truncated .css files and until further notice i've uncommented the staticfilehandler for .css, .js files to circumvent this problem. Its unconfirmed if it solves the issue and its only a solution to be able to develop.
I've posted an article on this and also contacted MS to get help on the truncated files issue. I'll get back when I know more.
I've changed all instances to System.Web.StaticFileHandler which has removed all of our problems. However, static files now aren't cached at all (Firebug reports 200 OK for all files, no 304s).
I'll try your solution and reintroduce the episerver static file handler cacheControl private.
If you haven't read Per's blog entry, this has been fixed in R2 SP2.