tags:

views:

473

answers:

3

Hi,

Does anywone know when a UnknownMessageReceived event on a WCF ServiceHost will be fired?

I have some code where I capture the Faulted en UnknownMessageReceived event but even when I post a wrong message to a particular service I never get the event.

Jochen

A: 

I guess (not sure though) it means that you get (back) a message that is not defined in your contract.

Krzysztof Koźmic
A: 

There's a blog entry by Wenlong Dong (yes, I know) that might point you in the right direction. I believe Wenlong is on the WCF team at MS.

ZombieSheep
This was not what I was looking for. The problem is the events don't get triggered. My best guess is that there is a difference between IIS hosting and custom hosting. If someone could confirm that ...
Jochen
+1  A: 

When the service receives a message on a channel, the ChannelDispatcher object at the top of the channel stack queries each of its associated EndpointDispatcher objects to determine which endpoint can process the message. If none of the EndpointDispatcher objects can accept the message, the WCF runtime raises the UnknownMessageReceived event on the ServiceHost object hosting the service. Chapter 3, Making Applications and Services Robust,” describes how to handle this event. ©(Microsoft® Windows® Communication Foundation Step by Step by John Sharp). http://download.microsoft.com/download/f/c/7/fc7d048b-b7a5-4add-be2c-baaee38091e3/9780735623361%5FMSWindowsCommFoundationSBS%5Fch13.pdf

I tried to rise this event too - without success. I had a bad message exception in common case (in Client side).

RredCat