惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

博客园 - 马啸西风

SQL Server 2008之XML数据存储 SQL Server 2008之托管代码 SQL Server 2008之触发器 SQL Server 2008之约束 SQL Server 2008之用户自定义函数 SQL Server 2008之错误处理 SQL Server 2008之创建高并发应用程序 SQL Server 2008之合并数据和表传递 SQL Server 2008之存储过程的设计和实现 SQL Server 2008之通过非聚集索引提高性能 SQL Server 2008之读取查询计划 SQL Server 2008之表结构实现 SQL Server 2008之索引设计 SQL Server 2008之视图的设计和实现 SQL Server 2008之表的设计和实现 SQL Server 2008之数据类型 垃圾收集导致的概率性发生的bug DataGridView中下拉列表框的实现 C#之集合
启用Application library caching时,将多个不同步的程序集打包到一个ZIP包中的问题
马啸西风 · 2012-10-31 · via 博客园 - 马啸西风

当用户重新访问网站时,Application library caching能够提高启动性能,当用户第一次访问网页的时候,Silverlight插件下载应用程序包和所有的外部程序集,这些文件会被加入到浏览器缓存中,以便在后续的访问中能够重用这些文件,关于Application library caching的详细介绍,可以参考下面的文档:http://msdn.microsoft.com/en-us/library/dd833069(v=vs.95).aspx

如果在实际项目中启用了Application library caching,并将多个公用程序集打包到一个ZIP包中,那么这些程序集必须被同时引用,否则就会出现意想不到的bug,可参考如下引用不同步出现bug的例子:

假设同一个解决方案下有如下两个Silverlight工程:A和B,这两个工程都启用了Application library caching,都引用了程序集AS1、AS2,工程A还额外引用了程序集AS3,AS1、AS2、AS3三个程序集都被配置为打包到Common.zip中,如下图:


当Build解决方案时:

  • 如果Build顺序是AB,即先Build工程A,生成的Common.zip中包含AS1AS2AS3三个程序集,在Build工程B,生成的Common.zip中只包含AS1AS2两个程序集,最终网站ClientBin目录下Common.zip中只包含程序集AS1AS2,如果此时运行解决方案,加载工程A时,就会出现程序集AS3无法加载的异常
  • 如果Build顺序为BA,即先Build工程B,生成的Common.zip中只包含程序集AS1AS2两个程序集,在Build工程A,生成的Common.zip中包含程序集AS1AS2AS3三个程序集,最终网站ClientBin目录下Common.zip中包含程序集AS1AS2AS3,如果此时运行解决方案,加载工程A和工程B都是没有问题的

如此依赖Build顺序的行为将产生很多不确定性,出现意想不到的bug;究其原因是我们将不能同步引用的程序集打包到了同一个ZIP包导致的,因此在配置程序集的Application library caching时,只有保证两个程序集能够被同步引用时,才可以打包到同一个ZIP包中,否则都应该打包到单独的ZIP包中;另外,很难确保能同步引用两个程序集,建议最好将每个程序集都打包到单独的ZIP包中