dotLess 文件并不总是加载在 IIS 7 上
在我的项目中,我使用 dotLess 来定义 css。一切工作正常,但由于某种原因,有时(通常在项目构建或服务器重新启动后,但并非总是如此)未加载较少的文件(IIS 返回 404 错误)。如果我刷新页面几次,加载的文件就会减少,之后通常一切都会好起来。 我知道,还有另一个关于 dotLess 和 ISS 404 错误的问题,但那里提出的解决方案(将 mimeMap 添加到 web.config)无助于解决我网站上的此问题。
有谁知道可能导致此错误的原因是什么?任何帮助将不胜感激:)
编辑:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
</modules>
<handlers>
<add name="StyleSheetManager" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />
<add name="ReportViewerWebControl" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="LessStyleCompiler" path="*.less" verb="*" type="dotless.Core.LessCssHttpHandler, dotless.Core"/>
</handlers>
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
</system.webServer>
这是 web.config 的一个片段,用于注册 dotLess。我的应用程序相当中等大小,而且我不认为这可能是因为我的计算机速度慢,因为许多机器上都会发生同样的事情,无论它有多强大。
in my project, I'm using dotLess to define css. Everything works fine, but for some reason, sometimes (usually after project build or server restart, but not always) less files are not loaded (IIS returns 404 error). If I refresh my page few times, less file is loaded and after that usually everything is ok.
I know, that there is another question about dotLess and ISS 404 error, but solution proposed there (adding mimeMap to web.config) did not help to resolve this issue on my site.
Does anyone know what might be causing this errors? Any help would be appreciated :)
Edit:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
</modules>
<handlers>
<add name="StyleSheetManager" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />
<add name="ReportViewerWebControl" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="LessStyleCompiler" path="*.less" verb="*" type="dotless.Core.LessCssHttpHandler, dotless.Core"/>
</handlers>
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
</system.webServer>
Here is a fragment of web.config, that registers dotLess. My application is rather medium size, also I don't think that this may be due to my computer being slow, as the same thing is happening on many machines, no matter how powerful it is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你能发布你的 web.config 吗?
这可能是您的计算机加载 HttpHandler 速度缓慢的问题?我真的不知道。
您的应用程序有多大?
您是否考虑过使用 dotless.Compiler.exe --watch 功能?
Could you maybe post your web.config?
It could be an issue of your computer being slow to load the HttpHandlers? I don't really know.
How large is your application?
Have you thought about using the dotless.Compiler.exe --watch feature?
由于
less
文件并不总是发送到浏览器,因此我们决定在设计时编译它们。为了实现这一目标,我们目前在 VS2010 中使用Chirpy
插件,该插件可以编译less
文件并最小化它们,从而输出纯css
文件。这样一切就正常了。但遗憾的是,处理程序遇到了一些问题,这将使我们的工作变得更好。
Because of those issues with
less
files not always being sent to browser, we decided to compile them on design-time. To achieve this we are currently usingChirpy
plugin to VS2010 which handles compilingless
files and minimizing them, giving in output plaincss
files. This way everything works.Thats a pity, though, that the handler had some issues, this would make our work much nicer.