MonoTouch - WCF Services made by Silverlight tool

2019-07-27 07:18发布

问题:

Using the Silverlight service generator a service class is created:

   slsvcutil.exe http://localhost/zzz/zzzz.svc?wsdl 
    /namespace:"*,General"  /d:z:\desktop /noConfig  /ser:DataContractSerializer

This class then is created and the async methods called.

Even with all calls and constructions wrapped in Exception try/catches, we can not catch errors like "System.ServiceModel.EndpointNotFoundException"

We have the exact same code running in Silverlight clients, and errors are caught in try/catch blocks.

Question: Is there another place/method I need to use in order to catch WCF errors when consuming in MonoTouch?

回答1:

I don't know if I understood your question well... :)

In my opinion, in the handler for the async request, check if the error is null or not.

if(e.Error != null)
{
  // insert code here to fix the error
  // in a similar way you do with catch block
}

else
{
  // normal execution
}

Hope it helps you!! Best regards.



回答2:

This appears to be a bug. The framework team is fixing it.