tags:

views:

13

answers:

1

The communication object, ExtendingWCFwithServiceHost.clsMyOwnHost, has overridden the virtual function OnOpening but it does not call version defined in the base class.

I'm getting this error while overriding the OnOpening method of the ServiceHost class.

Would appreciate any help.

Thanks.

+1  A: 

The error message explains the problem - you are overriding the OnOpening method but are not calling the base implementation. Your override should look like this:

protected override OnOpening()
{
    //additional processing
    base.OnOpening();
}

This page explains the ICommunicationObject state machine and says:

While System.ServiceModel.Channels.CommunicationObject.OnOpen(System.TimeSpan), System.ServiceModel.Channels.CommunicationObject.OnClose(System.TimeSpan), and System.ServiceModel.Channels.CommunicationObject.OnAbort have no default implementation, the other callbacks do have a default implementation which is necessary for state machine correctness. If you override those methods be sure to call the base implementation or correctly replace it.

Lee
Bingo!! Thank you!!
Josh