<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx</link><description>The most used feature of System.EnterpriseServices or COM+ is the distributed transaction support. And the automatic transaction programming model in ES using attributes ([Transaction] and [AutoComplete]) is great and nice but (it is always a but!)...</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#199311</link><pubDate>Wed, 28 Jul 2004 04:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:199311</guid><dc:creator>Milo</dc:creator><description>Hi&lt;br&gt;&lt;br&gt;Has anyone managed to try this code successfully and change the isolation level? ie. Something like:&lt;br&gt;objServiceConfig.IsolationLevel=EnterpriseServices.TransactionIsolationLevel.ReadUncommitted&lt;br&gt;&lt;br&gt;It seems to work nicely untill you try to change the isolationlevel (the stting is ignored).&lt;br&gt;&lt;br&gt;Regards&lt;br&gt;Milo</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#207786</link><pubDate>Wed, 04 Aug 2004 08:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:207786</guid><dc:creator>Alex Thissen</dc:creator><description>Nice entry.&lt;br&gt;This also works with XP SP1 if you have the appropriate Windows Update provided fixes installed. See also my blog-entry: &lt;a target="_new" href="http://www.alexthissen.nl/Weblog/PermaLink.aspx?guid=f6d61461-d336-40b0-9f4d-51eab6650f27"&gt;http://www.alexthissen.nl/Weblog/PermaLink.aspx?guid=f6d61461-d336-40b0-9f4d-51eab6650f27&lt;/a&gt;. FWIW, there is also an entry on TIP transactions using ServiceConfig and ServiceDomain.</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#207870</link><pubDate>Wed, 04 Aug 2004 12:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:207870</guid><dc:creator>Enrico Sabbadin</dc:creator><description>Hi, &lt;br&gt;personally I think that what's great about MTS-style transactions is that they are declarative, not that they are distributed.&lt;br&gt;Not quite often you need to target different stores. On the other hand, declarative transaction keep you domain/model - business/layer far from database transactions details. I think one typically thinks about transactions in term of business-application level transactions, not database transactions; that's why declarative transactions are so great... &lt;br&gt;I've used mts style transaction a logt in COM despite their impact on perfomances, however in my opinion using servicedcomponents in net 1.1 has so many twists and turns , and deploymenent requirements and bugs and .. that I had to drop it. &lt;br&gt;The solution proposed here is very interesting and drops all these twist and turns. Unfortunately the problem is that it isn't declarative stuff any more.. so it's ok for distributed transactional needs &amp;quot;only&amp;quot;.&lt;br&gt;&lt;br&gt;I developed a custom .NET data provider on my own to make transaction flow transparent to business-layer code .. you can find more info in my blog.&lt;br&gt; &lt;br&gt;my 2 cents &lt;br&gt;enrico&lt;br&gt;</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#207875</link><pubDate>Wed, 04 Aug 2004 12:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:207875</guid><dc:creator>Enrico Sabbadin</dc:creator><description>I forgot to say that obviously I'd like a [Transaction.Required] attribute that spins up a local transaction and promote to distributed only when needed. &lt;br&gt;Is this supposed to be supported on .net 2.0 ? </description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#209833</link><pubDate>Fri, 06 Aug 2004 13:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:209833</guid><dc:creator>Marcelo Lavio</dc:creator><description>&lt;br&gt;Hi,&lt;br&gt;&lt;br&gt;To Milo: Yes, I've changed successfully the TxIsolationLevel but to ReadCommitted (I never tried to change it to ReadUncommitted). So, i can say that, in general, changind the TxIsolationLevel works. But, if ReadUncommitted setting got ignored, it may be due to a bug on COM+ transactional services handling this kind of setting.&lt;br&gt;&lt;br&gt;To Florin: I'm trying the approach suggested here (using the ESTransactionScope class) on a project I'm working on. The code is nice, but I think a little change to the ESTransactionScope class is in order:&lt;br&gt;&lt;br&gt;If, for some reason, ServiceDomain.Enter() call on the EnterTxContext() method throws an exception, there will be no way to match the ServiceDomain.Enter() with a corresponding ServiceDomain.Leave() as required on the remarks of the ServiceDomain class overview (&lt;a target="_new" href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemEnterpriseServicesServiceDomainClassTopic.asp"&gt;http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemEnterpriseServicesServiceDomainClassTopic.asp&lt;/a&gt;).&lt;br&gt;&lt;br&gt;My suggestion is that the ESTransactionScope constructor shall only set the ServiceConfig object (like, for instance, the constructor of SqlConnection, which can be used to set up the connection string). Then the class should have Open() method (to set an IsOpen boolean private flag and call ServiceDomain.Enter()) and Close() method (to, if the IsOpen flag is true, set the IsOpen flag to false and call ServiceDomain.Leave()). The Dispose() method can then be changed to just call Close().&lt;br&gt;&lt;br&gt;That's my 2 cents.&lt;br&gt;Marcelo&lt;br&gt;</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#210531</link><pubDate>Sat, 07 Aug 2004 13:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:210531</guid><dc:creator>Marcelo Lavio</dc:creator><description>Hi Florin,&lt;br&gt;&lt;br&gt;I've done a deeper testing on COM+ Services Without Components and this ESTransactionScope class, and I found what I think is an important flaw on COM+ 1.5 SwC implementation.&lt;br&gt;&lt;br&gt;This is the situation: supose three &amp;quot;components&amp;quot;, all of them are transactional (transaction required). Let's say that one component has a method that is the transaction root (let's call it Component1.MethodTransactionRoot) and this method calls one method on the second component (Component2.MethodNestedCall1), and then a method on the third component (Component3.MethodNestedCall3) as per the following pseudo code:&lt;br&gt;&lt;br&gt;// on client&lt;br&gt;static void Main(string[] args) {&lt;br&gt;for (int i = 0; i &amp;lt; 3; i++) {&lt;br&gt; try {&lt;br&gt;  Component1 component1 = new Component1();&lt;br&gt;  component1.MethodTransactionRoot();&lt;br&gt; catch (Exception e) {&lt;br&gt;  Console.WriteLn(e.ToString());&lt;br&gt; }&lt;br&gt;}&lt;br&gt;}&lt;br&gt;&lt;br&gt;// on Component1&lt;br&gt;public void MethodTransactionRoot() {&lt;br&gt; Component2 component2 = new Component2();&lt;br&gt; component2.MethodNestedCall1();&lt;br&gt; Component3 component3 = new Component2();&lt;br&gt; component3.MethodNestedCall2();&lt;br&gt;}&lt;br&gt;&lt;br&gt;// on Component2&lt;br&gt;public void MethodNestedCall1() {&lt;br&gt; // do some transaction, vote for abort but do not throw an exception&lt;br&gt; // if this is a serviced component deactivate it on return&lt;br&gt;}&lt;br&gt;&lt;br&gt;// on Component3&lt;br&gt;public void MethodNestedCall2() {&lt;br&gt; // do some transaction and vote for commit&lt;br&gt; // if this is a serviced component, deactivate it on return&lt;br&gt;}&lt;br&gt;&lt;br&gt;If all this three components are traditional ServicedComponents (extending System.EnterpriseServices.ServicedComponent), at the time Component1.MethodTransactionRoot() calls Component3.MethodNestedCall2() you got an System.Runtime.InteropServices.COMException ((0x8004E003): You made a method call on a COM+ component that has a transaction that has already aborted or in the process of aborting.) as expected as the code in Component2.MethodNestedCall2 is bad code, because it didn't throw an exception, so the calling code tried to continue using a doomed transaction.&lt;br&gt;&lt;br&gt;But, besides that, as the Main() method continues to call Component1.MethodTransactionRoot(), every thing is the same, over and over again, as it should.&lt;br&gt;&lt;br&gt;The behaviour is completelly different if the code, instead of ServicedComponent, uses COM+ 1.5 SwC on each of the three components (where each &amp;quot;transactional&amp;quot; method calling ServiceDomain.Enter() and ServiceDomain.Leave()). As expected the same COMException will be thrown, at the same point in code, on the first call of the Main() method to the Component1.MethodTransactionRoot(). But all the other calls will fail when Component1.MethodTransactionRoot() calls ServiceDomain.Enter() again, when executing the other calls made from Main() method.&lt;br&gt;&lt;br&gt;The point is that if you call ServiceDomain.Enter() on a doomed transaction (a transaction that is aborting), you enter a non recoverable state that will prevent any furter success call to ServiceDomain.Enter() until you shutdown your application and then restart. This is much different than the behaviour of traditional ServicedComponents, and I consider it a flaw.&lt;br&gt;&lt;br&gt;As there is no fail safe way to detect if you are running a doomed transaction before make a call to ServiceDomain.Enter(), if any point of application code is sloppy (does not throw an exception when it votes for transaction abort), you risk to put the whole application down until next application restart.&lt;br&gt;&lt;br&gt;As per my tests, every call to ServiceDomain.Enter() creates a new COM+ Context (verified by calls to ContextUtil.ContextId), and every call to ServiceDomain.Leave() terminates that context.&lt;br&gt;&lt;br&gt;The problem happens when ServiceDomain.Enter() is called in a context which has a doomed transaction. The implementation of ServiceDomain.Enter() does some wrong thing in context management, and no call to ServiceDomain.Leave will be able to terminate the contexts that were created by the previous calls to ServiceDomain.Enter(). You can verify that using sucessive calls to ServiceDomain.Leave(); ContextUtil.ContextId; which returns the same ContextId over and over again (with transactional status 'Committed').&lt;br&gt;&lt;br&gt;Hope you can tell if this behaviour is &amp;quot;by design&amp;quot; or that you can carry this info to someone at Microsoft for further investigation.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;Marcelo Lavio&lt;br&gt;&lt;br&gt;PS.: Platform of tests is Windows 2003 Server, COM+ 1.5, .NET 1.1. I can send test code which demonstrates the problem. If interested, plese write to mlavio (at) hotmail dot com.</description></item><item><title>Databases, MSMQ, [you name a resource manager] and Services Without Components</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#229530</link><pubDate>Tue, 14 Sep 2004 21:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:229530</guid><dc:creator>Christian Weyer: Smells like service spirit</dc:creator><description /></item><item><title>Distributed Transactions </title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#346631</link><pubDate>Wed, 05 Jan 2005 04:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:346631</guid><dc:creator>gxh973121</dc:creator><description>Ping Back来自：blog.csdn.net</description></item><item><title>Using distributed transactions in .Net 1.x without deriving from ServicedComponent </title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#346762</link><pubDate>Wed, 05 Jan 2005 10:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:346762</guid><dc:creator>xdev</dc:creator><description>Ping Back来自：blog.csdn.net</description></item><item><title>Distributed Transactions </title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#386407</link><pubDate>Mon, 07 Mar 2005 09:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:386407</guid><dc:creator>gxh973121</dc:creator><description>TrackBack From:http://www.cnblogs.com/gxh973121/archive/2005/03/07/114394.html</description></item><item><title>Using distributed transactions in .Net 1.x without deriving from ServicedComponent </title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#390740</link><pubDate>Wed, 09 Mar 2005 18:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:390740</guid><dc:creator>coollzh</dc:creator><description>TrackBack From:http://www.cnblogs.com/coollzh/archive/2005/03/09/115813.html</description></item><item><title>Using distributed transactions in .Net 1.x without deriving from ServicedComponent </title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#392228</link><pubDate>Thu, 10 Mar 2005 19:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:392228</guid><dc:creator>Wes Shaddix</dc:creator><description /></item><item><title>Transaction.Current and Ambient Transactions</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#409571</link><pubDate>Tue, 19 Apr 2005 10:09:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:409571</guid><dc:creator>Florin Lazar's WebLog</dc:creator><description>Ambient transactions are defined as transactions that live in current thread or object context that anybody...</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#418218</link><pubDate>Tue, 17 May 2005 02:36:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:418218</guid><dc:creator>YeYan</dc:creator><description>RePost:&lt;br&gt;&lt;a rel="nofollow" target="_new" href="http://www.yeyan.cn/Database/distributedtransactionsderivingServicedComponent.aspx"&gt;http://www.yeyan.cn/Database/distributedtransactionsderivingServicedComponent.aspx&lt;/a&gt;</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#420654</link><pubDate>Sat, 21 May 2005 03:46:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:420654</guid><dc:creator>florinlazar</dc:creator><description>To: M. Lavio&lt;br&gt;&lt;br&gt;The bug that you are mentioning about calling Enter on an aborted transaction it is now fixed in Windows Server 2003 SP1. It will be also fixed in XP SP3. If you need the fix sooner, you can call Microsoft Support and ask for COM+ Rollup 9 for Windows XP.</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#457275</link><pubDate>Sun, 28 Aug 2005 15:14:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:457275</guid><dc:creator>rjn</dc:creator><description>Florin,&lt;br&gt;My application is running on windows2000,so serviceconfig won't work. You suggested using DonBox's approach at this url. &lt;a rel="nofollow" target="_new" href="http://www.gotdotnet.com/team/dbox/default.aspx?key=2004-07-12T08:40:44Z"&gt;http://www.gotdotnet.com/team/dbox/default.aspx?key=2004-07-12T08:40:44Z&lt;/a&gt; &lt;br&gt;I'm unable to find this url. Can you post the correct url please.&lt;br&gt;Thanks&lt;br&gt;&lt;br&gt;&lt;br&gt;</description></item><item><title>Enterprise Services: Some Light Reading</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#532968</link><pubDate>Thu, 16 Feb 2006 06:33:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:532968</guid><dc:creator>Kirk Allen Evans' Blog</dc:creator><description>Yeah, I am back on the ES kick again.&amp;amp;amp;nbsp; Some EnterpriseServices links to ponder.&lt;br&gt;Using Distributed...</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#663891</link><pubDate>Thu, 13 Jul 2006 03:01:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:663891</guid><dc:creator>Michael Herman (Parallelspace)</dc:creator><description>A naive question: If instead of using a console app for this demo, can I use/call ESTransactionScope() inside a .NET 1.1 ASMX Web service [WebMethod]?  

Anything special I have to do?

Part of my question is: do I have declare any special threading attributes (e.g. [MTAThread]) anywhere in my ASMX Web service class?</description></item><item><title>re: Using distributed transactions in .Net 1.x without deriving from ServicedComponent</title><link>http://blogs.msdn.com/florinlazar/archive/2004/07/24/using-distributed-transactions-in-net-1-x-without-deriving-from-servicedcomponent.aspx#788293</link><pubDate>Wed, 04 Oct 2006 04:13:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:788293</guid><dc:creator>florinlazar</dc:creator><description>&lt;p&gt;To: Michael&lt;/p&gt;
&lt;p&gt;No, nothing special as far as I'm aware of.&lt;/p&gt;
</description></item></channel></rss>