I have a simple WCF Service running on different environments. Today I tried to run it on my Windows 7 workstation and got this error on my client (which is simple console application for testing):
System.ServiceModel.ProtocolException: The incoming transaction cannot be deserialized. The transaction header in the message was either malformed or in an unrecognized format. The client and the service must be configured to use the same protocol and protocol version. The following exception occurred: Communication with the underlying transaction manager has failed.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ConsoleApplication1.ServiceReference1.ILookupService.GetMaritalStatus()
at ConsoleApplication1.ServiceReference1.LookupServiceClient.GetMaritalStatus() in D:\\Temp\\ConsoleApplication1\\ConsoleApplication1\\Service References\\ServiceReference1\\Reference.cs:line 46975
at ConsoleApplication1.Program.Main(String[] args) in D:\\Temp\\ConsoleApplication1\\ConsoleApplication1\\Program.cs:line 24
If I change endpoint on the client to call the same service from any other environment - it works just fine. I'm sure that something wrong with my workstation, but cannot figure out what is that. All settings in IIS are the same as on other servers. Other services work fine on the workstation.
The service contract looks like:
[ServiceContract]
public interface IMyService
{
[OperationContract]
[TransactionFlow(TransactionFlowOption.Allowed)]
[FaultContract(typeof(ServiceFault))]
Result MethodName(Guid id);
}
Implementation:
[ServiceBehavior(Name = "MyService", InstanceContextMode = InstanceContextMode.PerCall)]
public class MyService : IMyService
{
public Result MethodName(Guid id)
{
...
}
}
I haven't created this service, and not sure why we may need TransactionFlow attribute. Is that causes the issue. How can I fix it?
Fiddler showed the following response. Nothing that could help.
HTTP/1.1 500 Internal Server Error
Content-Length: 905
Content-Type: application/soap+xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 08 Jan 2014 18:45:33 GMT
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/transactions/fault</a:Action></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/transactions">a:TransactionHeaderMalformed</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">The incoming transaction cannot be deserialized. The transaction header in the message was either malformed or in an unrecognized format. The client and the service must be configured to use the same protocol and protocol version. The following exception occurred: Communication with the underlying transaction manager has failed.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope>
Looks like MSDTC security settings were reset by Windows Updates. I found the following log entries in the Windows Logs:
So I did two things:
1) Granted with Full Access the NetworkServices for msdtc.log:
2) Changed security settings for the Local DTC (Control Panel -> Administrative Tools -> Component Services -> My Computer -> Distributed Transaction Coordinator -> Local DTC -> Properties). I set the following (nothing was set at all):