silverLight调试出错
silverLight web中对应的TestPage可以正常打开但是把应用程序设为启动项目进行调试时 Client对应的BaseAddress 是:file:///E:/VS2010Test/SL/LoginTest/LoginTest/Bin/Debug/LoginTest
调用client_DownloadStringCompleted时
XmlReader reader = XmlReader.Create(new StringReader(e.Result)); //出错
“操作过程中出现异常,结果无效。有关异常的详细信息,请查看 InnerException”
具体代码:
private void Download_Click(object sender, RoutedEventArgs e)
{
Uri uri = new Uri(HtmlPage.Document.DocumentUri,"Images.xml");
WebClient client = new WebClient();
string baseurl = client.BaseAddress; //file:///E:/VS2010Test/SL/LoginTest/LoginTest/Bin/Debug/LoginTest
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync(uri);
}
private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
//使用Linq To XML处理数据
XmlReader reader = XmlReader.Create(new StringReader(e.Result)); //出错
XDocument doc = XDocument.Load(reader);
var list = (from image in doc.Descendants("image")
select new Uri(HtmlPage.Document.DocumentUri, image.Attribute("uri").Value)).ToList();
this.stackPanel1.Children.Clear();
foreach (var u in list)
{
//动态加载
Image image = new Image();
image.Width = 50;
image.Height = 50;
image.Source = new BitmapImage(u);
image.Margin = new Thickness(10, 10, 10, 10);
this.stackPanel1.Children.Add(image);
}
}
请问如何修改 ? silverLight 调试 --------------------编程问答-------------------- 有关异常的详细信息,请查看 InnerException --------------------编程问答-------------------- 请问怎么解决的呢?
补充:.NET技术 , ASP.NET