推薦文章:
http://www.cnblogs.com/hj4444/p/3857771.html
http://www.cnblogs.com/dozer/archive/2012/03/06/async-and-await-in-web-application.html
一般喜歡學習新技術的同學都用過.net4.5吧,那肯定會被簡單、高效的異步編程模型所吸引吧。
去年微軟發布了Microsoft.Bcl.Async,該包由三個庫組成:Microsoft.Bcl、Microsoft.Bcl.Async和Microsoft.Bcl.Build。
、
PM> Install-Package Microsoft.Bcl.Async
相關文章可以參考:
Microsoft.Bcl.Async is Now Stable
async 與 await 在 Web 下的應用
可能會碰到的問題:
1、出現編譯異常
那需要你檢查一下各項目中是否都有引用。由於使用了程序集統一的方式,解決方案中的所有工程都必須引用這三個庫。
2、使用異常
如果異常信息是“Message : Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)”,
那需要你去微軟官網下載.net4.0的KB2468871補丁來安裝。
Windows 7 Service Pack 1, Windows Server 2003 Service Pack 2, Windows Server 2008, Windows Server 2008 R2 SP1, Windows Vista Service Pack 1, Windows XP Service Pack 3