Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003

    Unhappy Unanswered: page timeout - ASP using COM to call a vbscript

    Hi group...

    Wondering if you could help me...

    I have an admin web site that we use on one of our win 2000 servers running IIS to run checkpoints(db backups) and tape backups (using ntbackup).

    OK so ntbackup is not the best backup routine to use but it works for our purposes...

    Here is what we have :

    1. First we have a windows batch file that does the work DAILY_DB_BACKUP.BAT:

    @ echo off
    :: Description : This windows batch file calls a vbscript file to backup the ingres
    :: databases on this host. The vbscript file will call ntbackup to
    :: backup the checkpoint, journal and dump areas of the file system
    :: first cleanup any old backups. Any files older than 5 days will be deleted
    rem we refresh the rsm database to recognise a media change
    start /wait rsm refresh /lf"Compaq DDS4 20/40 GB DAT Drive"
    :: now call the vbscript that does the backup to tape
    rem we pass in the user profile directory so that ntbackup logfile can be found
    c:\WINNT\system32\cscript.exe E:\DBA\BIN\daily_dbs_backup.vbs "%userprofile%"

    2. We have COM call this batch script. Here is the VB code within COM that allows the call to the windows batch script:

    Public Sub backup_dbs_to_tape()
    ''* Date : July, 2003
    '* Description : Does a Backup of All the ingres databases on the server. This is
    '* done by calling a batch script on the server called daily_db_backup.bat
    '* Parameters : IN
    '* DBA_TOP_DIR - set via asp page by call to isip_dba_dir, DBA home directory on the server
    '************************************************* ****************************

    Dim oFSO As New Scripting.FileSystemObject
    Dim f_FileResult As String
    Dim oWshShell, f_Result As String, f_FullCommand As String, f_EXEPath As String
    Dim WaitUntilFinished As Boolean
    Dim strCommand As String
    Dim StrLogFile As String

    localerroroutput = "" ' reset the error messages to indicate no errors
    ' set path to batch script to be run to backup the databases
    StrLogFile = DBA_TOP_DIR & "\LOG\dbs_to_tape.log"

    f_EXEPath = DBA_TOP_DIR & "\BIN\"

    ' backup in ingres databases on the server
    strCommand = "daily_db_backup.bat"

    WaitUntilFinished = True
    On Error GoTo backupfail

    ' Execute the backup batch file on the server

    ' Create an instance of the Windows Scripting Host to RUN the batch
    Set oWshShell = CreateObject("WScript.Shell")
    ' we use COMSPEC which is an environment variable to run our batch script.
    ' COMSPEC is an environment variable that should
    ' be set by windows to something like e.g. C:\WINNT\system32\cmd.exe. The /c switch tells the command line
    ' interpretor to exit after it has run the command
    ' NOTE : this is a good way of creating a wrapper to capture the output of a WSH command
    f_FullCommand = "%COMSPEC% /c " & f_EXEPath & strCommand & " > " & StrLogFile
    Debug.Print "Full command : " & f_FullCommand
    f_Result = oWshShell.Run(f_FullCommand, 1, WaitUntilFinished)

    Set oWshShell = Nothing

    If f_Result <> 0 Then
    GoTo backuperr
    End If

    ' Create optional result report
    tempstring = ""
    tempstring = tempstring & "WshShell Result = " & f_Result & vbCrLf
    tempstring = tempstring & f_FileResult & vbCrLf
    tempstring = tempstring & "Command Executed = " & strCommand & vbCrLf
    tempstring = tempstring & "Full Command Executed: " & f_FullCommand & vbCrLf
    Exit Sub
    On Error Resume Next
    Debug.Print "backup_dbs_to_tape() - An error has been found"
    localerroroutput = localerroroutput & "backup_dbs_to_tape() - Error: "
    errorhandle ' get the standrad VB errors
    Exit Sub
    On Error Resume Next
    Debug.Print "backup_dbs_to_tape() - An error has been found"
    localerroroutput = "backup_dbs_to_tape() - Failed to backup ingres databases"
    Exit Sub
    End Sub

    3. The COM function is called from an ASP page :

    'run the copy of the databases to tape
    on error resume next ' we handle COM errors ourselves
    set db_admin = server.createobject("admindba.admincls")
    db_admin.Ingres_Home_Dir = session("ingres_root_dir")
    db_admin.isip_database = session("sess_ckp_db")
    db_admin.isip_database_jnl_flag = session("sess_jnl_flag")

    session("backup_outcome") = ""
    session("backupresult") = ""

    call UpdateProgress ' Update Progress bar on client

    ' set the name of the root directory for DBA files
    db_admin.isip_dba_dir = session("str_dba_top_dir")

    call UpdateProgress ' Update Progress bar on client

    ' we can do the backup now of the ingres databases to tape
    db_admin.backup_dbs_to_tape ' RUN THE BACKUP OF DATABASES TO TAPE
    if db_admin.erroroutput <> "" or err.number <> 0 then
    session("backup_outcome") = "Unable to backup Ingres Databases to Tape : "
    session("backupresult") = "Backup to Tape Error : " & db_admin.erroroutput & vbCR & _
    ' we are ok
    session("backup_outcome") = "Successful Backup of Ingres Databases to Tape"
    session("backupresult") = "Backup to Tape Success : " & db_admin.textstr
    end if

    Now hopefully you follow exactly what I've done....

    The problem is that the ASP page above times out. So far I have :

    1. set the connection timeout within IIS to 14,400 which is more than enough as the backup only takes just over 1 hour
    2. set the "leave running when idle" option within COM under the "advanced" of the properties of the COM component

    I'm unsure what is causing the timeout and that's what I need to know as I figure that I've set IIS and COM not to timeout in under 2 hours....

    Do I have to simply kick off the vbscript and instead not wait until it's complete and forward to a page that will do an autorefresh and display the backup log file ??? I know I can do this but I REALLY REALLY want to know what is causing the timeout in the first place before I start looking at other options...

    Thanks in advance and I'm sure may people have encountered this problem before....

  2. #2
    Join Date
    Aug 2003

    Red face more info...

    It seems that after an hour the page times out but it doesn't give a timeout error....

    The error that gets display is the standard "The page cannot be displayed" error.

    I have tried cutting down the time the script takes to run the backup by only backing up a reduced set of directories and this all works fine...

    Any thoughts anyone ??? Could this be a firewall issue or TCP/IP timeout limit that is being encountered ???

  3. #3
    Join Date
    Sep 2003

    Re: more info...

    I'm not sure web servers are really designed to run procedures that long. I wouldn't ever try extending timeouts like that since it's detrimental to server performance.

    However have you looked into "Queued" Components? Queued components are COM+ objects that are asynchronous - fire and forget - but otherwise just like normal COM objects. Once the process completes (offline) it could write its completion status to a database that can be displayed by a web page. The user would need to continually refresh to see potential results.

    I don't think it's hard to convert a COM component into a "Queued" component but its been a while since I tried. It worked for me to render long running reports. Upon completion I sent an email to the user with a link to the results.

    If you really NEED the app to wait aound with an hourglass on the users machine then consider a webpage that deploys and starts a client-side .Net app to do your backup chores, etc... That way the web server can go on about its business while backups run...

    That's my 2. Hope it helps.
    Last edited by bill_dev; 09-12-03 at 22:20.

  4. #4
    Join Date
    Sep 2003

    Re: more info...

    P.S. If you get a standard error like ...

    "Page Cannot Be displayed" ... Internal Error 500 may want to change your browser's settings to see an *actual* error message. Go into Tools | Internet Options | Advanced tab and UNcheck the checkbox titled "Show friendly HTTP errors". Maybe it is something other than a timeout causing your problem.

    Last edited by bill_dev; 09-12-03 at 22:31.

  5. #5
    Join Date
    Oct 2003
    To get a more detailed ASP error, you need to modify your IIS settings. Open up your "Computer Manager" then right click your default website node under "Internet Information Services" and click properties. Then click on the "Home Directory" tab then the "Configuration Button". A new dialog pops up, then click the "APP Debugging" tab then select the "Send detailed ASP error messages to client" option under Script Error Messages.

    You can also do some debugging by selecting the check boxes under Debugging Flags. Getting the detailed error will help a lot...

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts