I'd like to follow YSlow's recommendation to serve static content from a cookieless subdomain. I'm confused about how to achieve this in an ASP.NET MVC and Azure context.
Do I have to create a new App Service (or Web App?) in the Azure portal? Or can I use my current App Service (or Web App?) and just tell some folders to be cookieless, or what? And then set up a CNAME record with my registrar to point static.example.com to what exactly?
Also, how would I go about serving my css file from static.example.com, considering MVC bundles and minifies it?
In ASP MVC you create bundles, at runtime, all your files in a bundle are merged into one, now, if yo uwant to activate the minification, here are the steps.
Bundling and minification is enabled or disabled by setting the value of the debug attribute in the compilation Element in the Web.config file. In the following XML, debug is set to true so bundling and minification is disabled.
<system.web>
<compilation debug="true" />
<!-- Lines removed for clarity. -->
</system.web>
To enable bundling and minification, set the debug value to "false". You can override the Web.config setting with the EnableOptimizations property on the BundleTable class. The following code enables bundling and minification and overrides any setting in the Web.config file.
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
// Code removed for clarity.
BundleTable.EnableOptimizations = true;
}
Finely, if your goal is to speed up you website and you are using Azure, best solution in my opinion is to create a CDN.