Re: How to diagnose WCF 'NotFound'

2011-09-20 Thread Neil Young
Greg,

You can also put this in the config file on the server side and see if
you get a file generated.  If so there will more than likely be some
info in there for you.

Warning it does generate a lot of data quickly.

system.diagnostics
trace autoflush=true /
sources
  source name=System.ServiceModel
  switchValue=Verbose, ActivityTracing
  propagateActivity=true
listeners
  add name=sdt
  type=System.Diagnostics.XmlWriterTraceListener
  initializeData=WCF_Log.svclog  /
/listeners
  /source
/sources
  /system.diagnostics

There's some viewer that must come with visual studio that knows how to read it.

Neil.

On 20 September 2011 14:58, Greg Keogh g...@mira.net wrote:
 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






RE: How to diagnose WCF 'NotFound'

2011-09-20 Thread Greg Keogh
Neil, Wallace, I created an ASP.NET client (instead of SL4) and attempted to 
upload 7MB and I get this stack of exceptions:

♦ CommunicationException: An error occurred while receiving the HTTP response 
to http://localhost/service/Aggregation.svc. This could be due to the 
service endpoint binding not using the HTTP protocol. This could also be due to 
an HTTP request context being aborted by the server (possibly due to the 
service shutting down). See server logs for more details.
♦ WebException: The underlying connection was closed: An unexpected error 
occurred on a receive.
♦ IOException: Unable to read data from the transport connection: An existing 
connection was forcibly closed by the remote host.
♦ SocketException: An existing connection was forcibly closed by the remote host

There is no extra useful information in there.

So I'm going to give up flogging this dead horse and change the service method 
to use streaming. I found a sample in one of my books that matches Wallace's 
comments about transferMode=Streamed. I'll run a few experiments. It's a good 
technique to known anyway and it will remove any hidden limits in this app.

Cheers,
Greg



RE: How to diagnose WCF 'NotFound'

2011-09-20 Thread Jake Ginnivan
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.netmailto:jake.ginni...@readify.net | W: 
www.readify.nethttp://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




RE: How to diagnose WCF 'NotFound'

2011-09-20 Thread Greg Keogh
Add a WCF error handler behaviour which changes the http return code to 200
even if there is an error (on the server side).

 

I've seen a few samples where people do this trick. However, I would rather
have a naked wrestling match with a rabid grizzly bear than write some WCF
behaviour code.

 

I will bear (no pun intended) this technique in mind for the future, but for
now the real fix is to use streaming.

 

Cheers,

Greg

 

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.ierro
rhandler.aspx as I change specific exceptions into particular fault
contracts globally (DomainException becomes DomainFault etc).



Re: How to diagnose WCF 'NotFound'

2011-09-20 Thread Stephen Price
Now I know what WCF really stands for. Wrestling Championship Federation.

Have you seen my bear, Tibbers? :)

On Wed, Sep 21, 2011 at 8:01 AM, Greg Keogh g...@mira.net wrote:

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

 ** **

 I’ve seen a few samples where people do this trick. However, I would rather
 have a naked wrestling match with a rabid grizzly bear than write some WCF
 behaviour code.

 ** **

 I will bear (no pun intended) this technique in mind for the future, but
 for now the real fix is to use streaming.

 ** **

 Cheers,

 Greg

 ** **

 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.aspxas
  I change specific exceptions into particular fault contracts globally
 (DomainException becomes DomainFault etc).



Re: How to diagnose WCF 'NotFound'

2011-09-20 Thread Grant Maw
Ye I think this whole naked bear wrestling thing is a wonderful idea.
Perhaps @ the next TechEd or CodeCamp Greg could do something like this. I
for one would pay good money to see it :)


On 21 September 2011 10:52, Stephen Price step...@littlevoices.com wrote:

 Now I know what WCF really stands for. Wrestling Championship Federation.

 Have you seen my bear, Tibbers? :)


 On Wed, Sep 21, 2011 at 8:01 AM, Greg Keogh g...@mira.net wrote:

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

 ** **

 I’ve seen a few samples where people do this trick. However, I would
 rather have a naked wrestling match with a rabid grizzly bear than write
 some WCF behaviour code.

 ** **

 I will bear (no pun intended) this technique in mind for the future, but
 for now the real fix is to use streaming.

 ** **

 Cheers,

 Greg

 ** **

 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.aspxas
  I change specific exceptions into particular fault contracts globally
 (DomainException becomes DomainFault etc).





RE: How to diagnose WCF 'NotFound'

2011-09-20 Thread Greg Keogh
Thanks Jake, I'll save that code sample. The reason I was so hostile to the
idea of writing behaviours comes from last year where I thought I had to
write one to allow an SL4 app to send authentication data with each WCF
call. I wanted to use the equivalent of a SOAP header which was really easy
to code in the old days to send the extra data out-of-band.

 

After searching for hours and reading my (awful) SAMS book on WCF I couldn't
even figure out which behaviour was the right one to use, then I'd have to
find a sample because it was really unclear just what arguments and data
were available at what points in the behaviour lifetimes. Then I discovered
that most of the behaviours were unavailable when using SL4 and WCF so was
wasting my time. It turns out I had to have lines like this sample in the
client call:

 

OperationContext.Current.OutgoingMessageHeaders.Add(MessageHeader.CreateHead
er(id, ClientService, Ticket.UserId));

 

I posted the details last year.

 

Greg



Re: How to diagnose WCF 'NotFound'

2011-09-19 Thread Wallace Turner
 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?




Yep, define this contract

|[ServiceContract]
public interface ISoftwareUpdater
{
[OperationContract()]
*Stream*GetDownloadStream(FileUpdate fileUpdate);
}
|

Define your endpoint as normal and your binding as:

|binding name=NetTcpStreamedBinding openTimeout=00:00:20 sendTimeout=00:30:00 receiveTimeout=00:30:00 
closeTimeout=00:00:01 maxReceivedMessageSize=10067108864*transferMode=Streamed*
security mode=Transport
transport clientCredentialType=None/
/security
/binding
|

which allows you to use a stream.



On 20/09/2011 12:58 PM, Greg Keogh wrote:


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:


bindingname=Bind1maxBufferSize=20971520maxReceivedMessageSize=20971520

maxBufferPoolSize=20971520

readerQuotasmaxArrayLength=131072maxBytesPerRead=20971520maxDepth=20971520

maxStringContentLength=20971520maxNameTableCharCount=131072/

On the client side I set:

publicconst 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