none
How does the COM+ transaction timeout work? RRS feed

  • Question

  • I do not understand, how the transaction timeout works in COM+. I have the class ClassComPlus which inherits from ServicedComponent, has transaction timeout attribute set to 1 second, and has a method SubSleep, that sleeps 3 seconds. I expect, the client which calls the method SubSleep to get an exception, because the transaction timeout has elapsed, but I do not get such an exception, the method completes without an exception. 

    Here is the code in VB.NET:

    1. Project Test1BO.vbproj as Class Library signed with a strong key, having the two files:

      1.1 AssemblyInfo.vb:

        Imports System.EnterpriseServices 
        Imports System.Reflection 
        Imports System.Runtime.InteropServices 
        <Assembly: ApplicationActivation(ActivationOption.Server)>  
        <Assembly: ApplicationAccessControl(CType(AccessChecksLevelOption.Application, Boolean))>  
        <Assembly: Guid("799facfd-af56-4496-bc18-618e2522e5f7")>  
        <Assembly: AssemblyVersion("1.0.0.0")>  
        <Assembly: AssemblyFileVersion("1.0.0.0")>

      1.2 ClassComPlus.vb

        Imports System.EnterpriseServices

        <Transaction(TransactionOption.Required, isolation:=TransactionIsolationLevel.ReadCommitted, timeout:=1), _
         EventTrackingEnabled(True), _
         JustInTimeActivation(True)> _
        Public Class ClassComPlus
            Inherits ServicedComponent

            Public Sub SubSleep()
                Try
                    Threading.Thread.Sleep(3000)
                    ContextUtil.SetComplete()
                Catch
                    ContextUtil.SetAbort()
                    Throw
                End Try
            End Sub
        End Class

    Test1BO must be registered in COM+ for example with the following RegisterComPlus.bat file in the folder where the dll is created:

        set regsvcs=C:\Windows\Microsoft.NET\Framework\v4.0.30319\regsvcs
        set topdir=%~dp0
        set dllname=Test1BO
        %regsvcs% /u "%topdir%\%dllname%.dll"
        %regsvcs% "%topdir%\%dllname%.dll"
        pause


    2. Project Test1CA.vbproj as Console Application with reference to Test1BO.dll has just Module1.vb:

        Module Module1
            Sub Main()
                Dim obj = New Test1BO.ClassComPlus
                Try
                    obj.SubSleep()
                    Console.WriteLine("SubSleep finished normally (unexpected)")
                Catch ex As Exception
                    Console.WriteLine("SubSleep threw exception (expected)")
                    Console.WriteLine(ex.ToString)
                Finally
                    obj.Dispose()
                End Try
                Console.ReadKey()
            End Sub
        End Module

    I would expect, that because the transaction timeout is 1 second, but the sleep time is 3 seconds, that the statement obj.SubSleep would throw an exception. Instead, obj.SubSleep finishes normally. 

    1. What am I doing wrong? 
    2. Did I wrongly understood the transaction timeout?
    Friday, November 11, 2016 7:25 AM

All replies

  • Since your question is specific to a development project you are working on, you would be better served to find an appropriate developer forum (https://social.msdn.microsoft.com/Forums/en-US/home).  This forum is for general questions about the operating system, not specific questions about how a .Net class works.

    . : | : . : | : . tim

    Friday, November 11, 2016 3:29 PM
  • I have posted it on at this link but they could not help me, so I thought of posting it here, as COM+ is an integral part of Windows Server.
    Monday, November 14, 2016 8:16 AM
  • Yes, and they provided the reason they were unable to help you - you are trying to use a very old programming method that is not used by many people anymore.  If the programmers are not aware of how to accomplish what you want to do, it is not likely that system administrator would know how to code the solution.

    It sounds like your best option is to either upgrade to a newer technology that is understood by more people, or you can contract with Microsoft or some other consulting group to provide you the education you are looking for.


    . : | : . : | : . tim

    Monday, November 14, 2016 4:19 PM
  • COM+ is an integral part of Windows Server 2012. And there is documentation about how to set the transaction timeout on this link. I would like to know how the transaction timeout works, because in the example I provided, it does not work. If the product provides this functionality, I want to use it, but I have to know exactly how it works. Is there no one from Microsoft who reads this forum who could help?
    Tuesday, November 15, 2016 9:28 AM
  • "Is there no one from Microsoft who reads this forum who could help?"

    I doubt it.  Or, if there is, it will be one or two people.  This forum is used to address general system administration type issues with Windows Server, not programming issues.  The greatest majority of readers of this forum are system administrators, not developers.  From reading the other post, you seemed to get a bit of a run-around there, but that was because you are asking about an older technology that is not used much any more.  But your questions really are much more developer focused than system administration focused.  Yes, it is included as part of the Windows operating system.  So is the FAX Server.  If you were to ask questions on the FAX server here, you would not find a lot of people familiar with it, either, because it, too, is old technology.

    If this is important, you may need to hire a contractor to assist you.  You might have a wait a long time before a developer familiar with COM happens to stumble onto this post.  Or you could get lucky and someone could answer in the next couple hours.  It's a gamble for you.


    . : | : . : | : . tim

    Tuesday, November 15, 2016 1:55 PM
  • I opened an issue at Microsoft 10 days ago, but still no answer. Strange, that one cannot have a clear description of a functionality provided by a product.
    Thursday, November 17, 2016 10:04 AM
  • When you say you 'opened an issue at Microsoft', was this an official, paid-for support case?  Have you checked back with them every day since you opened the case?  What sort of priority was assigned?  Have you asked to have it raised?

    Because it is an older technology, it is likely going to take a while to find someone who is familiar with it, particularly to the level of detail you are asking for.  There are all sorts of things that are included in Windows - not all of them have lots of current experts.


    . : | : . : | : . tim


    Thursday, November 17, 2016 1:31 PM
  • The Incident is the following:

    Microsoft Technical Support [wradmin@microsoft.com]:

    Microsoft Support Online
    Submit Incident 
    Confirmation number: 116110814908077

    Your question was successfully submitted to Microsoft. A Microsoft professional will contact you within 8 business hours.
    Case number: 116110814908077
    Case created: 11/8/2016 4:51:50 PM
    Case title: COM+ transaction timeout does not work
    Product: Visual Studio Enterprise 2015
    Severity: C
    E-mail address: pappasa@unisystems.gr
    Contact preference: Email

    A support engineer contacted me, but I have still no answer.

    Thursday, November 17, 2016 1:45 PM
  • Explanation for "How does the COM+ transaction timeout work?" already provided in locked thread https://social.msdn.microsoft.com/Forums/en-US/c7f4bebf-7337-4107-a883-72b18c83a36f/how-does-the-com-transaction-timeout-work?forum=vbgeneral along with much more information and links which OP disregards.

    La vida loca

    Tuesday, November 22, 2016 10:17 PM
  • Unfortunately, it was not answered why the COM+ transaction timeout does not work.
    Wednesday, November 23, 2016 11:19 AM
  • Unfortunately, it was not answered why the COM+ transaction timeout does not work.

    The question posed was the same question in this threads and two other threads, 4 threads with the same question, you posted. And the answer to the question was provided.

    The question was not "howcome I can not get COM+ transaction timeout to function?" but was "How does the COM+ transaction timeout work?". So please stick to the actual question and not move around about things other than the actual question. Or create a new question thread if you have new question.


    La vida loca

    Wednesday, November 23, 2016 7:04 PM