Transactions in an ASP Page

Discussion in 'ASP General' started by Evan Nelson, Jul 13, 2005.

  1. Evan Nelson

    Evan Nelson Guest

    We are running a website on 3 W2K servers running IIS 5.0 as the webservers
    and using a server running under Windows Server 2003 for the database
    servers. All of our ASP pages are written using VBScript and we use COM
    objects written in VB for our business logic.

    One of our pages was written using a transaction. The page started with
    @Transaction = Required. Basically a form posts to the page, the page
    retrieves info from the form, it then uses one COM object to update a couple
    SQL Server tables in one of our database, then it uses another COM object to
    write a record to a text file in a Share on the database server, it then uses
    a 3rd COM object to update some tables in a second database. Once it
    completes these steps, it executes ObjectContext.CommitTransaction then
    redirects the user to a different page.

    This page has been working well for us for a few years. Then about 3 1/2
    weeks ago, we changed our the database server to Windows Server 2003, it was
    previously another W2K box. Since then this page hangs. I threw in some
    debug statements that write to a text file on one of the webservers and I
    found that every single one of the statements prior to
    ObjectContext.CommitTransaction is executing but I never get past it. It
    appears that since the transaction is never committed that the objects
    created by the page are remaining and never getting cleaned up. Eventually
    this hangs the whole server.

    Since the problem started happening after we upgraded the database server to
    Windows 2003, I'm wondering if anyone has ever heard of issues using ASP
    Transactions when writing to text files on Windows 2003 servers from a W2K
    server?

    I removed the transaction from the page and it seems to work fine. I'm just
    wondering if maybe there is another way so we can keep the transaction.

    Thanks,

    Evan Nelson

    Here's a shortened version of the ASP page. When I commented out the lines
    that I've put *** in front of the page seems to work.

    ***<% @Transaction = Required %>
    <% Option Explicit
    On Error Resume Next
    ** All the DIM statements are omitted
    'Retrieve the registration information
    lngConsultantID = Request.QueryString("ConsultantID")
    lngChildren = Request.Form("children")
    ** Several Request.Form statements are omitted
    'Save the registration information in the consultant tables
    Set objConsultant = Server.CreateObject("Consult.Consultant")
    objConsultant.Initialize(lngConsultantID)
    strUserName = objConsultant.GetNewUserID
    ** Several lines that set properties on the object are omitted
    objConsultant.UpdateStatus = 0
    objConsultant.Update
    ** The next line actually makes an email account on a third party server - I
    have verified that it has been created.
    strErrorID = objConsultant.CreateMyEmail(strMyEmailAddress)
    objConsultant.Release
    Set objConsultant = Nothing
    err.Clear

    'Write out the registration information in the registration transfer file
    ** This is the COM object that is writing to the text file on the Database
    server disk
    share - I am seeing the record in the text file
    ** NOTE: If I commented out these lines the problem also went away.
    Set objDataStore = Server.CreateObject("DataStore.DataWrite")
    objDataStore.FileWrite CLng(lngConsultantID)
    ** The previous method call has more arguments that I have omitted
    Set objDataStore = Nothing
    err.Clear
    ' Build a WST Profile now that consultant has registered.
    Set objWConsultant = Server.CreateObject("PHWebSalesTools.clsConsultant")
    blnIsValid = True
    blnIsValid = objWConsultant.ReBuildWSTProfile( CLng(lngConsultantID),
    vntConsultantData )
    vntConsultantData = ""
    blnIsValid = objWConsultant.isValidConsultant(strUserName,
    Request.Form("password"), "", vntConsultantData)
    Set objWConsultant = Nothing
    err.Clear

    If blnIsValid Then
    strFullName = ( Trim(vntConsultantData(FIRST_NAME,0)) & " " &
    Trim(vntConsultantData(LAST_NAME,0)) )
    **Several lines that retrieve info from the vntConsultant are removed

    ' Create a Session and load default information
    Set objSession = Server.CreateObject("PHWebSalesTools.clsSession")
    strErrorID = objSession.CreateSession(lngConsultantID, strLanguageID,
    vntSessionID)
    strErrorID = objSession.preLoadConsultantData(vntSessionID, lngConsultantID)
    ** Several lines that set more properties of objSession have been
    omitted Set objSession = Nothing
    err.Clear
    End If
    ObjectContext.SetComplete
    strResponse = ("registerok.asp?sessionid=" & vntSessionID)
    Response.Redirect strResponse
    %>
     
    Evan Nelson, Jul 13, 2005
    #1
    1. Advertising

  2. I have not heard of this, but the security model is changed in Windows 2003.
    I would have one of the network admins research the security aspects, as this
    sounds like your issue.

    I am not understanding the transaction wrapping code that writes text files,
    however. Is this the method you are using to store data, or merely another
    step in the process of storing data?

    Without seeing the code, I cannot suggest other potential optimizations.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************


    "Evan Nelson" wrote:

    > We are running a website on 3 W2K servers running IIS 5.0 as the webservers
    > and using a server running under Windows Server 2003 for the database
    > servers. All of our ASP pages are written using VBScript and we use COM
    > objects written in VB for our business logic.
    >
    > One of our pages was written using a transaction. The page started with
    > @Transaction = Required. Basically a form posts to the page, the page
    > retrieves info from the form, it then uses one COM object to update a couple
    > SQL Server tables in one of our database, then it uses another COM object to
    > write a record to a text file in a Share on the database server, it then uses
    > a 3rd COM object to update some tables in a second database. Once it
    > completes these steps, it executes ObjectContext.CommitTransaction then
    > redirects the user to a different page.
    >
    > This page has been working well for us for a few years. Then about 3 1/2
    > weeks ago, we changed our the database server to Windows Server 2003, it was
    > previously another W2K box. Since then this page hangs. I threw in some
    > debug statements that write to a text file on one of the webservers and I
    > found that every single one of the statements prior to
    > ObjectContext.CommitTransaction is executing but I never get past it. It
    > appears that since the transaction is never committed that the objects
    > created by the page are remaining and never getting cleaned up. Eventually
    > this hangs the whole server.
    >
    > Since the problem started happening after we upgraded the database server to
    > Windows 2003, I'm wondering if anyone has ever heard of issues using ASP
    > Transactions when writing to text files on Windows 2003 servers from a W2K
    > server?
    >
    > I removed the transaction from the page and it seems to work fine. I'm just
    > wondering if maybe there is another way so we can keep the transaction.
    >
    > Thanks,
    >
    > Evan Nelson
    >
    > Here's a shortened version of the ASP page. When I commented out the lines
    > that I've put *** in front of the page seems to work.
    >
    > ***<% @Transaction = Required %>
    > <% Option Explicit
    > On Error Resume Next
    > ** All the DIM statements are omitted
    > 'Retrieve the registration information
    > lngConsultantID = Request.QueryString("ConsultantID")
    > lngChildren = Request.Form("children")
    > ** Several Request.Form statements are omitted
    > 'Save the registration information in the consultant tables
    > Set objConsultant = Server.CreateObject("Consult.Consultant")
    > objConsultant.Initialize(lngConsultantID)
    > strUserName = objConsultant.GetNewUserID
    > ** Several lines that set properties on the object are omitted
    > objConsultant.UpdateStatus = 0
    > objConsultant.Update
    > ** The next line actually makes an email account on a third party server - I
    > have verified that it has been created.
    > strErrorID = objConsultant.CreateMyEmail(strMyEmailAddress)
    > objConsultant.Release
    > Set objConsultant = Nothing
    > err.Clear
    >
    > 'Write out the registration information in the registration transfer file
    > ** This is the COM object that is writing to the text file on the Database
    > server disk
    > share - I am seeing the record in the text file
    > ** NOTE: If I commented out these lines the problem also went away.
    > Set objDataStore = Server.CreateObject("DataStore.DataWrite")
    > objDataStore.FileWrite CLng(lngConsultantID)
    > ** The previous method call has more arguments that I have omitted
    > Set objDataStore = Nothing
    > err.Clear
    > ' Build a WST Profile now that consultant has registered.
    > Set objWConsultant = Server.CreateObject("PHWebSalesTools.clsConsultant")
    > blnIsValid = True
    > blnIsValid = objWConsultant.ReBuildWSTProfile( CLng(lngConsultantID),
    > vntConsultantData )
    > vntConsultantData = ""
    > blnIsValid = objWConsultant.isValidConsultant(strUserName,
    > Request.Form("password"), "", vntConsultantData)
    > Set objWConsultant = Nothing
    > err.Clear
    >
    > If blnIsValid Then
    > strFullName = ( Trim(vntConsultantData(FIRST_NAME,0)) & " " &
    > Trim(vntConsultantData(LAST_NAME,0)) )
    > **Several lines that retrieve info from the vntConsultant are removed
    >
    > ' Create a Session and load default information
    > Set objSession = Server.CreateObject("PHWebSalesTools.clsSession")
    > strErrorID = objSession.CreateSession(lngConsultantID, strLanguageID,
    > vntSessionID)
    > strErrorID = objSession.preLoadConsultantData(vntSessionID, lngConsultantID)
    > ** Several lines that set more properties of objSession have been
    > omitted Set objSession = Nothing
    > err.Clear
    > End If
    > ObjectContext.SetComplete
    > strResponse = ("registerok.asp?sessionid=" & vntSessionID)
    > Response.Redirect strResponse
    > %>
    >
    >
    >
     
    Cowboy (Gregory A. Beamer) - MVP, Jul 15, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. psb
    Replies:
    0
    Views:
    1,666
  2. Mythran

    ADO.Net, Transactions, and ASP.Net

    Mythran, Apr 11, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    2,911
    Mythran
    Apr 12, 2005
  3. =?Utf-8?B?QXNo?=

    asp.net transactions

    =?Utf-8?B?QXNo?=, Nov 12, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    315
    Mark Rae
    Nov 12, 2006
  4. David C. Barber
    Replies:
    3
    Views:
    556
  5. Shaun Stuart
    Replies:
    6
    Views:
    260
    Shaun Stuart
    Sep 27, 2004
Loading...

Share This Page