Open RIA Services User Support Trying to solve NotFound debugging errors with Endpoint Behavior on a Domain Service, even with correct attributes  Viewed 8600 time(s), 2 post(s)., 2/26/2015 10:06:29 PM - by tstedel

tstedel
tstedel 2/26/2015 10:07:14 PM

We are having issues with the Domain service sometimes returning NotFound errors. 

IncludeExceptionDetailInFaults = true,
[ErrorBehavior(typeof(EmailExceptionErrorHandler))]

We have these attributes applied to the domain service to try to get a better understanding of errors on the server. It will email exception information to us.

The following method returns errors to the silverlight client correctly(we will see the text "Some Exception" instead of a NotFound exception, useful for debugging). In terms of configuration, I believe we have done all that we can to make exceptions visible to the client.

public string Test()
{
          throw new Exception("Some Exception");
}

This is a test method I made in the domain service to show the problem. Here you will see that the enumerable is deferred.
public IEnumerable<String> Test()
        {
            return Enumerable.Select<int ,string>(new[] { 0 }, i =>
            {
                throw new Exception("This is an exception");
            });
        }

This will throw a NotFound error on the silverlight client and bypass our server exception handling (The email dispatcher), leaving us with only that an error happened(quite commonly with entities as all of the queries return IEnumerable). The only solution I can think of is to call ToList() on everything and force the exception to occur within our methods to get the error to be properly processed. Is there a better way? We have an EndpointBehavior that forces all errors to return a 200 http status code. We can easily apply this to vanilla WCF services, however we can not find a suitable extensibility point in the Domain service pipeline or the web.config to add this endpoint behavior to the domain service.

Any help would be appreciated! Thank you for your hard work, we really enjoy OpenRiaServices.

This content has not been rated yet. 
15 Reputation 1 Total posts
1
ColinBlair
ColinBlair 3/3/2015 5:44:38 PM

The DomainService has an overridable method named OnError which is where you should hook in any error handling that you want to do.

This content has not been rated yet. 
1539 Reputation 130 Total posts
2