在 Visual Studio 2010 中使用 Cassini 提供自定义 HttpHandler 文件
只是使用 Visual Studio 2010 和 ASP.NETMVC 2 尝试使用 Less
HttpHandler
进行 CSS 预处理,但我无法提供 .Less
文件输入我想要的方式。
我在 web.config
中添加了一个处理程序部分,这是以前使用 Cassini 时 VS 2008 所需的全部内容:
<httpHandlers>
<add type="dotless.Core.LessCssHttpHandler,dotless.Core" validate="false" path="*.Less" verb="*"/>
</httpHandlers>
在 VS2010 中,文件以纯文本形式提供。 MVC 框架或 Cassini 所需的附加信息是否随 2010 年发生变化?
编辑:
我并不真正关心如何使用 VS2010 来提供更少的文件(我知道 T4 模板)。我正在尝试找出 HttpHandler 服务失败的具体原因。
Just playing around with our Less
HttpHandler
for CSS preprocessing using Visual Studio 2010 and ASP.NETMVC 2 and I am unable to serve the .Less
file type how I'd like to.
I have added a handler section to the web.config
which is all that was previously required with VS 2008 when using Cassini:
<httpHandlers>
<add type="dotless.Core.LessCssHttpHandler,dotless.Core" validate="false" path="*.Less" verb="*"/>
</httpHandlers>
With VS2010 the file is being served as plain text. Is additional information required by the MVC framework or the Cassini change with 2010?
Edit:
I don't really care about finding anyway to serve Less files with VS2010 (I know about the T4 template). I'm trying to find out specifically why serving the HttpHandler fails.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许这就是您所需要的?
T4CSS:.Less CSS 的 T4 模板压缩
它有效地为每个
.less
文件生成缩小的CSS 文件。这应该会给您带来 .less 的好处,同时将它们转换为普通的 CSS 文件!Maybe this is what you need?
T4CSS: A T4 Template for .Less CSS With Compression
It effectively generates minified CSS files for each
.less
file. This should give you the benefits of .less, along with having them being transformed into ordinary CSS files!您的 Http 处理程序是否被调用?我对 IIS7 没有太多经验,但我知道只有某些文件/请求类型会路由到 ASP.NET 管道(例如 .aspx 和 .ascx)。
如果网络服务器未配置为向 asp.net 发送 .less 请求,则您的 .net Http 处理程序将无法查看。
我假设您引用的 HTTP 处理程序是您编写的 .net 处理程序 -但对于任何处理程序来说都是如此。
Is your Http Handler even being called? I don't have much experience with IIS7 specifically, but I do know that only certain file/request types are routed to the ASP.NET pipeline (such as .aspx and .ascx).
If the webserver isn't configured to send .less requests to asp.net then your .net Http Handler won't get a look in.
I'm assuming the HTTP Handler you refer to is a .net one you've written - but it would be the case for any handler.