Add a WCF error handler behaviour which changes the http return code to 200 
even if there is an error (on the server side).

The browser sees the http 500 return code which WCF returns when an exception 
is thrown, which the browser gets before Silverlight, then all Silverlight sees 
is a http 404.

See http://msdn.microsoft.com/en-us/library/ee844556(v=vs.95).aspx for more 
info on how to actually implement it. Although I have implemented using 
http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.ierrorhandler.aspx
 as I change specific exceptions into particular fault contracts globally 
(DomainException becomes DomainFault etc).

Regards,
Jake Ginnivan
Readify | Senior Developer | MVP (VSTO)
M: +61 403 846 400 | E: 
jake.ginni...@readify.net<mailto:jake.ginni...@readify.net> | W: 
www.readify.net<http://www.readify.net/>

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of Greg Keogh
Sent: Tuesday, 20 September 2011 12:58 PM
To: 'ozDotNet'
Subject: How to diagnose WCF 'NotFound'

Folks, I have a WCF service hosted in IIS that is called by an SL4 app to send 
client files to the server. Years ago I updated various configuration values to 
allow up to 20MB transfer. This is on the server side:

<binding name="Bind1" maxBufferSize="20971520" maxReceivedMessageSize="20971520"
    maxBufferPoolSize="20971520">
    <readerQuotas maxArrayLength="131072" maxBytesPerRead="20971520" 
maxDepth="20971520"
    maxStringContentLength="20971520" maxNameTableCharCount="131072"/>

On the client side I set:

public const int MaxBufferSize = 20971520;
:
bind.MaxBufferSize = LaserMetrics.MaxBufferSize;
bind.MaxReceivedMessageSize = LaserMetrics.MaxBufferSize;

However I just reproduced a problem where a 7MB file is causing an exception 
inside the WCF call. It dies on the WCF method asynch callback with this error:

System.ServiceModel.CommunicationException occurred
  Message=The remote server returned an error: NotFound.

There is nowhere I can break to find out what's going on, so I was wondering if 
there is a trick to get more out of the underlying exception. There's probably 
an obscure config settings I haven't found yet. I presume there is some size 
related config option that I've missed somewhere, but where.

Perhaps I should use some sort of "streaming" technique between SL4 and the 
service, but I've not needed it before and haven't read up on exactly how it's 
done. I believe there is a way of sending a Stream that can be read in chunks 
and allow progress reporting. Is that right? Anyone done it?

Cheers,
Greg


Reply via email to