asp.net - Bundles Caching and Web farms -


i know implications of modifying bundles collection dynamically (say during load of page). tried adding new script file bundles collection (originally created in app_start). working fine in initial test, - 1 difference noticed browser not caching bundled script , style(sending new requests on every refresh). know if there way force caching of bundle script/style after initial fetch.

i have static scripts , styles loaded bundles collection in app_start itself. have piece of code in master page load, check existence of page specific script or styles (for ex. lets page abc.aspx being loaded, code existence of abc.js in scripts folder , abc.css in styles folder). if exists it'll loaded page header. tried adding bundles. best approach make these conditional scripts/styles part of default bundle collection?

my production environment web farm. there should have url v hash remain same across servers?

i'd read comment "hao kung" here, explaning bundle caching issue webfarms (results in 404), best approch handle this?

afaik, when building bundle, content hashed in order create unique key (the parameter in url).

so if modifying contents hash change since represents different bundle. whole purpose of cache busting when content changes.

the behavior seeing because bundles not intended used in dynamic way, since goes against idea bundle's content static (and therefore cacheable).

why not create separate bundle each page? way, "common" bundle, shared code cached , reused, , when loading abc.aspx page, load "abc" bundle, own version control on contents , not affect common libraries.

plus, there additional downside modifying bundle on each page:

if each page delivers different bundle, client receive code shared libraries on , on again, once each page. if cached. example: there no point in sending jquery along each page.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -