我使用反向代理下的SOAP WCF Web服务。
以下是我对该服务所做的操作:
public static async Task chargementDonnees(foooooooooo client)
{
IsolatedStorageSettings.ApplicationSettings["equipe"] = await Tools.getEquipeTask(client);
IsolatedStorageSettings.ApplicationSettings["attelage"] = await Tools.getAttelageTask(client);
IsolatedStorageSettings.ApplicationSettings["depart"] = await Tools.getDepartTask(client);
IsolatedStorageSettings.ApplicationSettings["heure"] = await Tools.getHeureTask(client);
IsolatedStorageSettings.ApplicationSettings["localisation"] = await Tools.getLocalisationTask(client);
IsolatedStorageSettings.ApplicationSettings["natureintervention"] = await Tools.getNatureInterventionTask(client);
IsolatedStorageSettings.ApplicationSettings.Save();
}
以下是一个名为:
的函数示例public static Task<List<Localisation>> getLocalisationTask(fooooo client)
{
var tcs = new TaskCompletionSource<List<Localisation>>();
client.GetLocalisationCollectionCompleted += (sender, e) =>
{
tcs.SetResult(e.Result);
};
client.GetLocalisationCollectionAsync();
return tcs.Task;
}
以下是reference.cs文件中异常抛出的屏幕截图:
我试图捕获webservice发送的异常,例如,如果我的凭据是假的。我在这里设置了一个try catch bloc,但是这里没有例外。它发生在reference.cs文件中。有人可以解释如何处理来自webservice的reference.cs中的异常抛出? THX
如何确保在具有WP8应用程序的RP下使用WCF Web服务?
答案 0 :(得分:0)
这是一个关于使用async / await方法捕获异常的链接:
http://lunarfrog.com/blog/2013/11/10/windows81-async-void-exceptions/