Compress and Minify WebResource.axd and ScriptResource.axd in ASP.NET 4 WebForms(在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 ASP.NET 4 WebForms 中压缩和缩小 WebResource.axd 和
基础教程推荐
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- WPF 模态进度窗口 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
