Script timed out Message added to Binary File End

P

Prabhat

Hi Friends,

I have code that will "BinaryWrite" a EXE file of 20mb to client using the
ADO Stream. After the download the EXE file works fine without any problem.

When I verified the EXE that gets downloaded to client machine that EXE has
the below text added to the bottom:
---------------------------------------------
<font face="Arial" size=2>.<p>Active Server Pages</font> <font face="Arial"
size=2>error 'ASP 0113'</font>.<p>.<font face="Arial" size=2>Script timed
out</font>.<p>.<font face="Arial"
size=2>/Roctek/ProcessDownload.asp</font>.<p>.<font face="Arial" size=2>The
maximum amount of time for a script to execute was exceeded. You can change
this limit by specifying a new value for the property Server.ScriptTimeout
or by changing the value in the IIS administration tools..</font>
----------------------------------------------

So I can see that it is a Script TimeOut Error. So can you please guide me
where the problem is comming and how can I rectify this. (Including the ASP
code that BinaryWrite the file)
---------------------------------------------
Function DownloadFile(strFilename)
dim stFile
Response.Buffer = True
Response.Clear

Set stFile = Server.CreateObject("ADODB.Stream")
stFile.Open
stFile.Type = 1 'Set as BINARY

On Error Resume Next

Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<h1>Requested file does not exists! Please contact Roctek
Support.</h1><P>")
Response.End
end if
Set fFile = fso.GetFile(strFilename)
iFileLength = fFile.Size

stFile.LoadFromFile(strFilename)

Response.AddHeader "Content-Disposition", "attachment; filename=" &
fFile.Name
Response.AddHeader "Content-Length", iFileLength
Response.Charset = "UTF-8"
Response.ContentType = "application/octet-stream"

Response.BinaryWrite stFile.Read
Response.Flush
Response.Buffer = False
Response.Clear

Set fso = Nothing
Set fFile = Nothing
stFile.Close
Set stFile = Nothing
End Function
-----------------------------------------------------------

I am using IIS 5 on Windows 2000 Server. Please guide me to solve the
problem

Thanks
Prabhat
 
B

Bob Barrows [MVP]

Prabhat said:
Hi Friends,

I have code that will "BinaryWrite" a EXE file of 20mb to client
using the ADO Stream. After the download the EXE file works fine
without any problem.

When I verified the EXE that gets downloaded to client machine that
EXE has the below text added to the bottom:
---------------------------------------------
<font face="Arial" size=2>.<p>Active Server Pages</font> <font
face="Arial" size=2>error 'ASP 0113'</font>.<p>.<font face="Arial"
size=2>Script timed out</font>.<p>.<font face="Arial"
size=2>/Roctek/ProcessDownload.asp</font>.<p>.<font face="Arial"
size=2>The maximum amount of time for a script to execute was
exceeded. You can change this limit by specifying a new value for the
property Server.ScriptTimeout or by changing the value in the IIS
administration tools..</font>
----------------------------------------------

So I can see that it is a Script TimeOut Error. So can you please
guide me where the problem is comming and how can I rectify this.
(Including the ASP code that BinaryWrite the file)

Is something wrong with your google skills? Or your ability to search
www.aspfaq.com?

Add this to your page:
Server.ScriptTimeout =<whatever value it takes to eliminate the error>
 
P

Prabhat

Is something wrong with your google skills? Or your ability to search
www.aspfaq.com?

Add this to your page:
Server.ScriptTimeout =<whatever value it takes to eliminate the error>
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Hi Bob,

I am aware that we can use <% Server.ScriptTimeout = n %> but I wanted to
know is this the correct aproach to Solve???

But I am wondering that if there is some other way that I can do in my asp
code that stream the file. Also If I set the timeout in any procedure will
that timeout be local to procedure or global to application?

Thanks
Prabhat
 
P

Prabhat

Is something wrong with your google skills? Or your ability to search
www.aspfaq.com?

Add this to your page:
Server.ScriptTimeout =<whatever value it takes to eliminate the error>
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
About Script Timeout I have seen the page:
http://www.aspfaq.com/show.asp?id=2066
 
B

Bob Barrows [MVP]

Prabhat said:
Hi Bob,

I am aware that we can use <% Server.ScriptTimeout = n %>

:)
OK, so my lack of mind-reading/clairvoyancy skills have been exposed ...
but I
wanted to know is this the correct aproach to Solve???

But I am wondering that if there is some other way that I can do in
my asp code that stream the file.

Only if whatever you did had the result of reducing the time taken to
process the file. If that's what you're asking then there probably is not
anything you can do to affect this without a third-party component.
Also If I set the timeout in any
procedure will that timeout be local to procedure or global to
application?
As the article you cited states: the setting only has effect for the page in
which it is set.

Bob Barrows
 
P

Prabhat

Hi Bob,

thanks for those info. I have to use the Server.ScriptTimeout for this to
around 1800 sec as the file size is 20 mb.

Thanks
Prabhat
 
A

Anthony Jones

Prabhat said:
Hi Friends,

I have code that will "BinaryWrite" a EXE file of 20mb to client using the
ADO Stream. After the download the EXE file works fine without any problem.

When I verified the EXE that gets downloaded to client machine that EXE has
the below text added to the bottom:
---------------------------------------------
<font face="Arial" size=2>.<p>Active Server Pages</font> <font face="Arial"
size=2>error 'ASP 0113'</font>.<p>.<font face="Arial" size=2>Script timed
out</font>.<p>.<font face="Arial"
size=2>/Roctek/ProcessDownload.asp</font>.<p>.<font face="Arial" size=2>The
maximum amount of time for a script to execute was exceeded. You can change
this limit by specifying a new value for the property Server.ScriptTimeout
or by changing the value in the IIS administration tools..</font>
----------------------------------------------

So I can see that it is a Script TimeOut Error. So can you please guide me
where the problem is comming and how can I rectify this. (Including the ASP
code that BinaryWrite the file)
---------------------------------------------
Function DownloadFile(strFilename)
dim stFile
Response.Buffer = True
Response.Clear

Set stFile = Server.CreateObject("ADODB.Stream")
stFile.Open
stFile.Type = 1 'Set as BINARY

On Error Resume Next

Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<h1>Requested file does not exists! Please contact Roctek
Support.</h1><P>")
Response.End
end if
Set fFile = fso.GetFile(strFilename)
iFileLength = fFile.Size

stFile.LoadFromFile(strFilename)

Response.AddHeader "Content-Disposition", "attachment; filename=" &
fFile.Name
Response.AddHeader "Content-Length", iFileLength
Response.Charset = "UTF-8"
Response.ContentType = "application/octet-stream"

Response.BinaryWrite stFile.Read
Response.Flush
Response.Buffer = False
Response.Clear

Set fso = Nothing
Set fFile = Nothing
stFile.Close
Set stFile = Nothing
End Function
-----------------------------------------------------------

I am using IIS 5 on Windows 2000 Server. Please guide me to solve the
problem

Thanks
Prabhat

You should also consider this article.

http://www.aspfaq.com/show.asp?id=2161

The second approach that chunks the file down out the response would be
better for
a 20MB file especially on if deployed on IIS6.0.

Anthony.
 
P

Prabhat

You should also consider this article.

http://www.aspfaq.com/show.asp?id=2161

The second approach that chunks the file down out the response would be
better for
a 20MB file especially on if deployed on IIS6.0.

Anthony.
Hi Anthony,

Thanks for the link. it is having good info. Also I liked the way it stream
the binary write in chunks using ther buffer = False.

Can I set the Buffer = False and send data without Chunks?

Thanks
Prabhat
 
A

Anthony Jones

Prabhat said:
Hi Anthony,

Thanks for the link. it is having good info. Also I liked the way it stream
the binary write in chunks using ther buffer = False.

Can I set the Buffer = False and send data without Chunks?

You can but it doesn't make any difference from having Buffer = True and
doing a single large binarywrite.

Rather than thinking of Buffer = false meaning 'don't buffer' think of it
more as 'flush buffer after each write or binarywrite'.

On IIS6 the default buffer limit is 4MB. Even with Buffer = False if you
attempt to write your 20MB file in single call to binarywrite you will
exceed the buffer limit and get an error.

Anthony.
 
P

Prabhat

You can but it doesn't make any difference from having Buffer = True and
doing a single large binarywrite.

Rather than thinking of Buffer = false meaning 'don't buffer' think of it
more as 'flush buffer after each write or binarywrite'.

On IIS6 the default buffer limit is 4MB. Even with Buffer = False if you
attempt to write your 20MB file in single call to binarywrite you will
exceed the buffer limit and get an error.

Anthony.
Hi Anthony,

you are correct in concept. So now I think :
Buffer = False and BinaryWrite with Chunks is better approach.

Thanks
Prabhat
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top