Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Application times out 1

Status
Not open for further replies.

wyattmc

Technical User
Nov 5, 2002
3
US
Hi,
I have a web app that runs, however it runs longer than 3 minutes and does not refresh the page in time and I receive this error:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the system event log of the web server. Please review this log entry to discover what caused this error to occur.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How do I refresh a the page or change the time limit from 3 minutes or both??

Thanks
wyattmc
 
By "it runs for 3 minutes" do you mean its doing processing and not showing a page for 3 minutes?

If so, you could have some memory leak and are actually bringing down your web server!

Could you give more detail of what your page is actually doing?

D'Arcy
 
My App may run anywhere from 1 minute to 3 hours because of what I have it doing. I would like my page to say processing... while my app is working, but I don't know how to temporarely break away to update my page.

Code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub btnTextFiles_OnClick(Source As Object, E As EventArgs)
Dim di As New DirectoryInfo(filePath)
Dim fi As FileInfo
Dim fw as StreamWriter
Dim myProcess As Process
Dim strTempBat as string
For Each fi In di.GetFiles()
fw = New StreamWriter("\temp.bat", True)
fw.WriteLine(myProgramThatRunsALongTime)
fw.Close()
strTempbat = filePath & "\temp.bat"
myProcess = System.Diagnostics.Process.Start(strTempBat)
myProcess.WaitForExit()
myProcess.Close()
File.Delete(strTempBat)
intFileCount = intFileCount + 1
Next
End Sub 'btnTextFiles_OnClick
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks
 
1 to 3 HOURS?!

ok...we should look at the architecture of this then, because a web app may not be what you want here. Let me explain:

Each session has a timeout value. This is necessary because if it didn't, your webserver would get jammed up with processing and storing variables, and it would cease to function (usually showing a familiar Server Application Unavailable error). The idea though is that if someone is actively interacting with the site, then the session stays live. But if inactivity happens, the session will die.

Whats happening in your case is that you're asp.net page is calling some code that is doing some MAJOR processing. The timeout of your IIS is probably kicking in before the processing is complete, effectively killing your app.

HOWEVER, I wouldn't suggest bumping up your timout to 3 hours, because that means that if I log into your site, and close my browser, unless you can catch that and abandon my session, my session will stay active for 3 HOURS! Multiply a few hundred users, if not thousands depending on usage and traffic, and your site won't last too long.

So here are some options for you:
1. Create a Windows Service. This is a program that runs in the background of the server. When you need some processing done, you could have your aspx page pass some vars to the service and get it going, while telling your users to "come back later" to retrieve their data. This will do a few things:
a. It will take the processing load off of IIS
b. You're users won't have to have their browser open for 3 hours just to see the results; they can come back later.

2. If its something like report generation, try and automate the process during non-busy hours.
i.e. if a financial report is run every thursday morning, instead of the users having to request it, just have a service or some other application automatically crate the report at a pre-determined time (like 2 am for instance), so all the users do in the morning is grab the finished report (which also was processed during a non-busy time, so it probably won't take as long)

If you'd like more insight on how to rectify this, let us know a bit more detail about what it is you're trying to do (and why its taking 3 hours max to do it; although I'm guessing its report related)

hth

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top