IIS output cache for particular VD without affecting other VDs sharing same physical/virtual path

This post has been republished via RSS; it originally appeared at: IIS Support Blog articles.

Recently we were working on a case and would like to share the steps that we took to achieve it.

 

--We   had  multiple Virtual directories  hosted under one site . All of the Virtual directories  pointing to same central  Directory as their physical path hence  sharing  the same web.config file .

--we wanted to disable IIS output caching for one VD alone. So basically changes made to one VD should not affect the other.

What does Output caching do? IIS automatically caches static content (such as HTML pages, images, and style sheets), since these types of content do not change from request to request. IIS also detects changes to the files when you make updates, and IIS flushes the cache as needed.

 

--When we were doing it at Virtual Directory level, it was affecting other VDs as well which is expected as they were sharing same web.config file.

 

 

So we performed the below steps:

  • Removed the caching line from web.config file
  • Add the below lines in the apphost.config files as required( I have 2 VDs here VD1 and VD3)

     <location path="testing/VD3" overrideMode="Deny">

            <system.webServer>

                <caching enabled="false" />

            </system.webServer>

        </location>

                               

                                <location path="testing/VD1" overrideMode="Deny">

            <system.webServer>

                <caching enabled="true" />

            </system.webServer>

        </location>

                               

clipboard_image_4.jpeg

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.