积极答复者
WebClient 下载东西 有疑问

问题
-
我这个测验用的是 asp web 承载的
int index = uri.IndexOf("/ClientBin");
CHAPTER 6 ■ THE APPLICATION MODEL
220
// In this example, the URI includes the /ClientBin portion, because we've
// decided to place the DLL in the ClientBin folder.
uri = uri.Substring(0, index) + "/ClientBin/ResourceClassLibrary.dll";
// Begin the download.
WebClient webClient = new WebClient();
webClient.OpenReadCompleted += webClient_OpenReadCompleted;
webClient.OpenReadAsync(new Uri(uri));主要是下面的这个方法 程序根本就不走它啊! 那位高人知道 什么地方触发了webClient.OpenReadCompleted 的 ,
private void webClient_OpenReadCompleted(object sender,
OpenReadCompletedEventArgs e)
{
if (e.Error != null)
{
// (Add code to display error or degrade gracefully.)
}
else
{
AssemblyPart assemblypart = new AssemblyPart();
assemblypart.Load(e.Result);
}
}
答案
-
你好,
比较奇怪,你是在哪里进行下载的,是在RootVisual设置之前还是之后。是在oob模式下么。
因为在SL3的OOB中,如果在rootvisual设置前去调用service,callback不会fire.
这个在SL4里修复了
- 已标记为答案 Min-Hong Tang - MSFT 2010年4月7日 7:08
全部回复
-
你好,
比较奇怪,你是在哪里进行下载的,是在RootVisual设置之前还是之后。是在oob模式下么。
因为在SL3的OOB中,如果在rootvisual设置前去调用service,callback不会fire.
这个在SL4里修复了
- 已标记为答案 Min-Hong Tang - MSFT 2010年4月7日 7:08