model view controller - MVC bundle with Azure CDN - how to enable caching -
i have web site hosted in azure has lot of javascript , css small pages. have javascript , css delivered via cdn.
azure provides neat , convenient mechanism allow described here https://azure.microsoft.com/en-us/documentation/articles/cdn-cloud-service-with-cdn/#integrate-aspnet-bundling-and-minification-with-azure-cdn
in short, add following code bundleconfig.cs
bundles.usecdn = true; var version = system.reflection.assembly.getassembly(typeof(controllers.homecontroller)) .getname().version.tostring(); var cdnurl = "http://axxxxxx6.vo.msecnd.net/{0}?v=" + version; scriptbundle scriptbundle = new scriptbundle("~/bundles/xx", string.format(cdnurl, "bundles/xx")); scriptbundle.include( "~/scripts/modernizr-*", "~/scripts/jquery-{version}.js", "~/scripts/jquery.signalr-{version}.js", "~/scripts/jquery.watermark.js", ....
i have followed instructions letter , on surface appears work expected.
but realised caching these cdn provided resources disabled. every time web page requested js , css downloaded again - defeats purpose of cdn altogether.
i have included following in web.config
<staticcontent> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="15.00:00:00"/> </staticcontent>
what missing here?
thanks in advance.
dave a
Comments
Post a Comment