在 ASP.NET 4 WebForms 中压缩和缩小 WebResource.axd 和 ScriptResource.axd [英] Compress and Minify WebResource.axd and ScriptResource.axd in ASP.NET 4 WebForms

查看:26
本文介绍了在 ASP.NET 4 WebForms 中压缩和缩小 WebResource.axd 和 ScriptResource.axd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了一个星期来减少我们的 Web 应用程序上的请求数量,但我似乎无法合并 .axd 文件.我从本地工作(开发箱)的某个地方得到了一个建议,但在我们的测试和生产环境中不起作用,因为它们都在 HTTPS 上.开发者没有对此发表评论,他写的组件最后一次更新是在 2011 年.(我会找到链接并更新这篇文章).

I have been trying for a week now to reduce the number of requests on our web application but I can't seem to combine the .axd files. I got a suggestion from somewhere which worked locally (development box) but doesn't work on our test and production environment as they are both on HTTPS. The developer didn't comment on that and the component he wrote was last updated in 2011. (I will find the link and update this post).

我尝试在 ScriptManager 中使用 CompositeScript,但它再次不适用于测试/生产环境.

I tried using the CompositeScript in ScriptManager and again it doesn't work on Test/Production environments.

我使用 SquishIt 来解析其他文件.(见附件)

I used SquishIt to resolve the other files. (see attachment)

推荐答案

要强制它在您的环境中工作,请设置 ScriptMode="Release" 例如:

To force it work on your environment, set ScriptMode="Release" eg as:

<asp:ScriptManager ID="ScrMang" runat="server" ScriptMode="Release"  >
    <CompositeScript>
    <Scripts>
        <asp:ScriptReference name="MicrosoftAjax.js"/>
        <asp:ScriptReference name="MicrosoftAjaxWebForms.js"/>
        <asp:ScriptReference name="Common.Common.js" assembly="AjaxControlToolkit"/>
    </Scripts>
    </CompositeScript>
</asp:ScriptManager>

更多注意事项

要查找要在 CompositeScript 中添加的脚本,您可以使用以下代码:http://aspnet.codeplex.com/releases/view/13356 并从这个页面获得更多关于如何使用它的帮助:https://lancezhang.wordpress.com/2008/11/15/aspnet-ajax-performance/

Some more notes

To find what scripts to add inside CompositeScript you can use the code from here : http://aspnet.codeplex.com/releases/view/13356 and get more help how to use it from this page : https://lancezhang.wordpress.com/2008/11/15/aspnet-ajax-performance/

这篇关于在 ASP.NET 4 WebForms 中压缩和缩小 WebResource.axd 和 ScriptResource.axd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆