IDispatchOperationSelector.SelectOperation Method
Associates a local operation with the incoming method.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Parameters
- message
- Type: System.ServiceModel.Channels.Message%
The incoming Message to be associated with an operation.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Problem debugging
I too have observed this problem. Makes it very difficult to debug using a custom IDispatchOperationSelector.
- 5/11/2011
- PhilDeg
This message cannot support the operation because it has been read.
I am observing the same behavior as Johgoe. My SelectOperation gets called twice when the call originates from within the VS IDE debugger. If I run the client outside of the debugger, the SelectOperation method is called only once and everything works as expected. After the second call returns, the server reports the following error;
"This message cannot support the operation because it has been read."
I believe my SelectOperation is constructed correctly, I think the real question is why is it getting called twice when the client is executed in the debugger...
public string SelectOperation(ref System.ServiceModel.Channels.Message message)
{
XmlDictionaryReader bodyReader = message.GetReaderAtBodyContents();
XmlQualifiedName lookupQName = new XmlQualifiedName(bodyReader.LocalName, bodyReader.NamespaceURI);
message = CreateMessageCopy(message, bodyReader);
if (dispatchDictionary.ContainsKey(lookupQName))
{
return dispatchDictionary[lookupQName];
}
else
{
return null;
}
}
"This message cannot support the operation because it has been read."
I believe my SelectOperation is constructed correctly, I think the real question is why is it getting called twice when the client is executed in the debugger...
public string SelectOperation(ref System.ServiceModel.Channels.Message message)
{
XmlDictionaryReader bodyReader = message.GetReaderAtBodyContents();
XmlQualifiedName lookupQName = new XmlQualifiedName(bodyReader.LocalName, bodyReader.NamespaceURI);
message = CreateMessageCopy(message, bodyReader);
if (dispatchDictionary.ContainsKey(lookupQName))
{
return dispatchDictionary[lookupQName];
}
else
{
return null;
}
}
- 4/23/2010
- johnlwebb