谁能解释一下微软的CDN?
我知道我可以从他们的 CDN 获取我的 asp.net 应用程序的脚本文件,但是实现此目的的最佳方法是什么?它说如果我启用脚本管理器的属性,请求将被重定向到 CDN,但这实际上是什么意思?
目前我们有很多页面引用了 JQuery,有些是从 google 引用的,有些是本地引用的。我是否需要更改所有这些引用以指向 Microsoft?那么 scriptmanager 的 CDN 属性有何影响呢?
有我可以使用的全球解决方案吗?
I understand I can get my script files from their CDN for my asp.net application, but what's the best way to implement this? It says that requests will be redirected to the CDN if I enable the property of the script manager, but what does that actually mean?
At the moment we have lots of pages which reference JQuery, some reference it from google, some reference it locally. Do I change all these references to point to Microsoft? How does the CDN property of the scriptmanager affect things then?
Is there a global solution I can use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Scott Guthrie 在他的 上很好地解释了这一点博客。
基本上,如果您在 ASP.net 4.0 中的 ScriptManager 块上设置 EnableCdn="true",则对于 ASP.Net 通常引入的任何标准 Javascript 包含文件,它将从 Microsoft CDN 获取它。这包括 ScriptManager 等的客户端站点组件等库。
您还可以选择直接为 JQuery 等提供 CDN url - 这些不会由上述标志处理。
无论您是否从 Google 的 CDN 切换到 Microsoft 都是您的优先选择之一 - Google 在许多支持 Javascript 的网站中包含了他们的 CDN,这给了您很大的机会已经缓存了他们的文件,而 Microsoft 也同样在他们的网站上包含了他们的 CDN,但他们的网站的曝光率可能低于 Google。
这是一个折腾,随心所欲,但就我个人而言,我不再在本地引用,除非它是一个 Intranet 应用程序、使用自定义 JQuery 或有离线需求。
Scott Guthrie explains it nicely on his blog.
Basically, if you set EnableCdn="true" on your ScriptManager block in ASP.net 4.0, for any standard Javascript include file that ASP.Net normally brings in, it will instead get it from the Microsoft CDN. This includes libraries such as the client site components of the ScriptManager et al
You also have the option of supplying CDN urls for JQuery et al directly - these will not be handled by the above flag.
Whether or not you switch from Googles CDN to Microsofts is one of preference - Google includes theirs in many of their Javascript enabled sites, which gives you a huge chance of having their file already cached, while Microsoft similarly include theirs on their sites, but their sites may have less exposure than Googles.
It's a toss up, go with what you want, but personally I don't reference locally any longer unless its an Intranet app, uses a custom JQuery, or has an offline requirement.