WCF MSDTC Transaction elevated but not executed
I am not an expert on WCF and MSDTC so hopefully this is something simple. I have a client server, a web services server and a database. I want to be able to wrap calls to the web services server within a TransactionScope so that if something fails within the operation, I can back out. This setup works fine when all 3 components live on my local machine. When I move them to the separate servers, everything works until a call is within a TransactionScope.
I can see a transaction get added on both the client and web services server under dcomcnfg -> component services -> Computers -> My Computer -> Distributed Transaction Coordinator -> Local D开发者_JAVA技巧TC. I see the same transaction show up on both machines. Problem is, it just waits for the timeout and fails. If I look at my transaction logs for the web service calls that should have taken have taken place within the TransactionScope, they are not there.
What am I missing?
I don't advise using TransactionScope across WCF service boundaries but if you must read this:
http://www.stevefenton.co.uk/Content/Blog/Date/200911/Blog/TransactionScope-and-WCF-Services/
I recently saw similar symptoms when configuring NServiceBus and NHibernate with MSDTC.
The resolution for my issue involved checking the authentication being used.
In the Distributed Transaction Coordinator's local DTC, go the the properties and check the Security tab. It may be that you need to enable the Network DTC access, or alter the authentication used. Try with no authentication to see if that works, and lock down as appropriate.
In this case, it ended up being a firewall issue. I put off the idea of it being a firewall issue since I was seeing the transaction appear in the service server transaction list but adding the Distributed Transaction Coordinator to the allowed list for domain communication in the firewall fixed the issue.
精彩评论