When I'm trying to close a channel, I sometimes get the following error:
The channel received an unexpected input message with Action 'http://tempuri.org/ICalibrationSettings/SetPositionResponse' while closing.
You should only close your channel when you are not expecting any more input messages.
My code does the following:
CHWKey key = GetKey(state);
var Settings = GetCalibrationSettings();
try
{
Settings.SetPosition(CHWKey, Angle);
}
finally
{
IChannel channel = Settings as IChannel;
if ((channel != null) && (channel.State == CommunicationState.Opened))
{
channel.Close();
}
}
Now I understand the error, but I'm not sure how to close the channel gracefully or to avoid closing the channel if unexpected input message arrives.
Really hope somebody can help me! Thanks a lot :)