I finally figured out the source of my HTTP 400 problem. Apparently the Windows Communication Foundation deals with exceptions differently depending on your InstanceContextMode settings. I had been using the Single setting but I should have used the PerCall setting. In PerCall mode, the try/catch block works as expected.
I think it has something to do with the way that WCF distinguishes between channel exceptions and message faults.
Anyway, if you’re building a REST web service, you’ll want to make sure your class is decorated with the following ServiceBehavior attribute.
2 Comments
Vish
This seems like a bug in the product. Thanks for bringing it tou our notice
22 May 2008 03:05 pm
Dean
No worries, Vish. I’m glad I could help. It makes me feel a bit better to know that it’s not just me.
22 May 2008 04:05 pm
Leave a Comment