我得與單純方法的問題界河從asp.net ashx的4串得到。我正在運行由該asp.net應用程序託管的silverlight應用程序的方法。的URI前綴無法識別OnDownloadStringCompleted
private void LoadPlugins()
{
var serviceAddress = _baseAddress
+ "PluginsService.ashx?"
+ DateTime.Now.Ticks;
var client = new WebClient();
client.DownloadStringCompleted += client_DownloadStringCompleted;
client.DownloadStringAsync(new Uri(serviceAddress));
}
void client_DownloadStringCompleted(
object sender,
DownloadStringCompletedEventArgs e)
{
var plugins = e.Result.Split(
new string[] { Environment.NewLine },
StringSplitOptions.RemoveEmptyEntries);
foreach (var plugin in plugins)
{
AddXap(_baseAddress + plugin);
}
}
PluginsService.ashx.cs:
namespace MefPlugins.Web
{
/// <summary>
/// Summary description for PluginsService
/// </summary>
public class PluginsService : IHttpHandler
{
private const string PluginsFolderName = "Plugins/";
public void ProcessRequest(HttpContext context)
{
//var pluginFolder = new DirectoryInfo(
// HttpContext.Current.Server.MapPath(
// PluginsFolderName));
//var response = new StringBuilder();
//if (pluginFolder.Exists)
//{
// foreach (var xap in pluginFolder.GetFiles("*.xap"))
// {
// response.AppendLine(
// PluginsFolderName + xap.Name);
// }
//}
var response = new StringBuilder();
response.Append("test");
context.Response.ContentType = "text/plain";
context.Response.Write(response);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
我得到一個錯誤:
System.Reflection.TargetInvocationException是由用戶代碼未處理 消息=在操作過程中出現的異常,使結果無效。檢查異常詳情的InnerException。 堆棧跟蹤: 瓦特System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 瓦特System.Net.DownloadStringCompletedEventArgs.get_Result() 瓦特MefPlugins.MainPage.client_DownloadStringCompleted(對象發件人,DownloadStringCompletedEventArgs E) 瓦特System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs E) 瓦特System.Net.WebClient.DownloadStringOperationCompleted(對象ARG) 的InnerException信息:System.Net.WebException 消息=一個Web客戶端請求期間發生異常。 InnerException:System.NotSupportedException Message =無法識別URI前綴。 堆棧跟蹤: 瓦特System.Net.WebRequest.Create(URI requestUri) 瓦特System.Net.WebClient.GetWebRequest(URI地址) 瓦特System.Net.WebClient.DownloadStringAsync(URI地址,對象userToken) 的InnerException:
哪裏可能是一個錯誤?這是http://www.galasoft.ch/sl4u/code/chapter20/20.02-Mef/MefPlugins.zip的一個例子
你知道我會問這個......什麼是URI前綴? 「_baseAddress」的外觀是什麼? –
而你在這裏。什麼是(如果有的話)在「檢查異常詳情的InnerException」 – Eddy
serviceAddress是「file:////PluginsService.ashx?634485607882333736」 – user278618