Less stylesheet file 406 on IIS7/discountaspnet
I have a site, http://www.allampersandall.com that i'm trying to post up to discountasp.net. It runs great locally in VS2010 debug, but when i post it up all my .less files HTTP 406.
When i looked up HTTP 406, it says its the br开发者_StackOverflow中文版owser not accepting it-- but why would it run locally but not up on live?
Any ideas?
Thanks,
I fixed this in the end....
The 406 error is basically telling you that there was a mismatch between what the browser was expecting and what the server sent it.
In my case it was the fact that my web.config was telling the browser that any files with an extension of .less were to be served as the mime type "text/css".
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
Where as, in my site, the file was being declared as "text/less"
<link href="@Url.Content("~/Content/style.less")" rel="stylesheet/less" type="text/less" />
To fix it I changed the "mimeType" setting in the web.config to match the declaration in the page so the web.config section is now:
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/less" />
</staticContent>
I hope that helps!
Cheers
精彩评论