ProtocolException calling WCF from a WF TransactionScope
I'm getting a SOAP exception telling: "The header 'OleTxTransaction' from the namespace 'http://schemas.microsoft.com/ws/2006/02/tx/oletx' was not understood by the recipient of this message, causing the message to not be processed. This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process. Please ensure that开发者_运维百科 the configuration of the client's binding is consistent with the service's binding. "
The method is defined as (by default has TransactionFlowOption.NotAllowed):
[OperationContract]
Foo GetFoo(int fooId);
Other method in the same service is defined like:
[OperationContract]
[TransactionFlowOption.Allowed]
Foo GetFooTransactional(int fooId);
The first one would throw the exception when called within a WF TransactionScope activity, but not when calling it from a regular console application with a TransactionScope.
The second works in any case. I could just allow transactions in every method, but for several reasons I don't want to do that.
I'm using named pipe bindings allowing transaction flow in clients and server. Server:
<netNamedPipeBinding>
<binding transactionFlow="true" transactionProtocol="OleTransactions" transferMode="Buffered" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</netNamedPipeBinding>
Client:
<netNamedPipeBinding>
<binding name="DefaultNamedPipeConfig" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="true" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
It seems to be a bug in the 4.0 release
I updated Server and Client to .Net4.6.2 and the Error magicaly disapeared. The Error showed up in my Development after the Server was updated from .Net 4.0 to 4.5. I think this most of the time a .Net Version but can of course be a config issues as well. My Software was working fine before i had to update the Server because a DLL was updated to .Net 4.5.
GoodLuck
精彩评论