Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am just getting this message on index page when we use .less file


FileError: 'http://localhost:40733/Content/mainsite.less' wasn't found (404)
in mainsite.less


What I have tried:

<head>
<title>Demo Less</title>

<link type="text/css" rel="stylesheet/less" href="Content/mainsite.less" />
<script src="Scripts/less.min.js"></script>



</head>




<body>


Hello World!


This example contains some advanced CSS methods you may not have learned yet. But, we will explain these methods in a later chapter in the tutorial.





</body>
Posted
Updated 10-May-16 21:00pm

1 solution

You need to add MIME type in your config file :
HTML
<system.webserver>
  <staticcontent>
    <mimemap fileextension=".less" mimetype="text/css" />
  </staticcontent>
</system.webserver>


Please try this and let me know if it works.
 
Share this answer
 
Comments
Er. Pradeep Kumar Rai 11-May-16 3:07am    
Sorry Sir , i am getting IID error after adding this code in web config file.


My config is --


<configuration>
<system.web>
<compilation debug="true" targetframework="4.5">
<httpruntime targetframework="4.5">
<!-- <httphandlers>
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core">
-->



<system.webserver>
<staticcontent>
<mimemap fileextension=".less" mimetype="text/css">



Raje_ 11-May-16 3:11am    
What error exactly are you getting? Did you check if you have not added system.webserver twice? if there is already code writted for webserver and static content, you need to add only mimemap section.
Er. Pradeep Kumar Rai 11-May-16 3:58am    
<pre lang="text">Config Source:
13:
14: <configsections>
15:
</pre>






More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.
View more information »

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900