Thursday, September 13, 2007

Attack Of The Blob!


(Image taken from WikiPedia's entry on The Blob!)

Yesterday I had a frustrating day trying to modify a CSS file for a SharePoint look and feel task.


For some reason, no matter what I did, the CSS never refreshed in the browser. When viewed in SharePoint Designer it did show the updated version, but no amount of IIS resets, file deletion, or browser cache clearing prevented my web browsers (both Internet Explorer and Firefox) from rendering the old version.

Eventually I happened to look on the file system and notice a folder on the root called "blobcache". Aha! I was using a new Virtual Machine and unbeknownst to me Blob Caching had been enabled to improve performance.

Inside this blob cache folder I found my css file with a .cache file extension on the end of it. I tried to delete manually but it then started to show "File Not Found." errors.

The solution was to flush the blob cache. The option is on the site collection's Site Settings. Select "Site Collection Object Cache" and then click "Force this server to reset its disk based cache."

The BlobCache is enabled in the web.config file and looks like this:


<BlobCache location="C:\blobCache" path="\.(gifjpgpngcssjs)$" maxSize="10" enabled="true" />


I could just remove the css reference from the path but during development I think the better approach is to just to set enabled to false.

Interesting note: David Marsh and I think SharePoint Designer was able to view the newly deployed file because it was using WebDav and so was hitting the database rather than having IIS redirect it to the BLOB cache which is what happened to the browsers.

2 comments:

  1. Great ti. Jeez - it must have been frustrating chasnging CSS, and trying to work out WHY it won't bloody refresh !!!

    Damn caching - it's great, but can mess with developers.

    ReplyDelete
  2. Yeah, it was painful. My first professional programming experience ever was also like that: writing Java code three or four different ways and wondering why it wasn't changing. I figured it was something about the Servlets I didn't understand but of course it was caching. Sometimes you forget to check!

    ReplyDelete

Note: only a member of this blog may post a comment.