In a .NET 4.0 WCF service, I have the Closed event hooked. The method/event looks like this right now:
void host_Closed( object sender , EventArgs e )
{
Console.WriteLine("Host closed.");
}
But I would like to cast sender or e to something useful so I can do better logging than that. What Types are acceptable there?
The ICommunicationObject events don’t give you much to go on. If you want rich error info to log, you’ll have to implement IErrorHandler and install your error handler in your service’s ChannelDispatcher (by means of behaviors).