pause code in a web application?
am 23.01.2008 03:17:14 von PaulHi just wondering if running a web application in a single thread is it
possible to add a pause in the code?
Thanks
--
Paul G
Software engineer.
Hi just wondering if running a web application in a single thread is it
possible to add a pause in the code?
Thanks
--
Paul G
Software engineer.
The simple answer is yes. Thread.Sleep(xx) will do that.
A bit longer answer is that you should review your application architecture
to check if that is indeed what you want and need to do.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Paul"
news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
> Hi just wondering if running a web application in a single thread is it
> possible to add a pause in the code?
> Thanks
> --
> Paul G
> Software engineer.
After serious thinking Paul wrote :
> Hi just wondering if running a web application in a single thread is it
> possible to add a pause in the code?
> Thanks
System.Threading.Thread.Sleep(...) with a TimeSpan or a number of
milliseconds.
but why would you want to do that?
Hans Kesting
"Paul"
news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
> Hi just wondering if running a web application in a single thread is it
> possible to add a pause in the code?
As others have said, it is possible, but why on earth would you want to
deliberately delay a web response...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
thanks for the responses, I have some sort of timeout issue I think but it
does seem like slowing the web response may not be a solution. I have a
document that is used in Crystal reports and on the method document.close I
get the error,
object not set to an instance of an object, like it has not been
instantiated. Works fine for short queries under a minute or so and only
occurs on long queries, were data is processed for several years. Also not
sure if crystal report has some sort of default timeout if it is waiting for
something.
--
Paul G
Software engineer.
"Mark Rae [MVP]" wrote:
> "Paul"
> news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
>
> > Hi just wondering if running a web application in a single thread is it
> > possible to add a pause in the code?
>
> As others have said, it is possible, but why on earth would you want to
> deliberately delay a web response...?
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
>
IMO it's always best to try first (if not already done) to solve the initial
problem.
Not sure what kind of document you are talking about. If using automation
note that some products are not intended for server side use. You also have
a script timeout that prevent long running pages etc etc...
For now it lloks like the object that represent this document doesn't exists
(for example if the document is already opened, opending another instance of
it could perhaps fails).
--
Patrice
"Paul"
D8E5C645-AB66-4B7C-8B3F-1BE4B9123CD4@microsoft.com...
> thanks for the responses, I have some sort of timeout issue I think but it
> does seem like slowing the web response may not be a solution. I have a
> document that is used in Crystal reports and on the method document.close
> I
> get the error,
> object not set to an instance of an object, like it has not been
> instantiated. Works fine for short queries under a minute or so and only
> occurs on long queries, were data is processed for several years. Also
> not
> sure if crystal report has some sort of default timeout if it is waiting
> for
> something.
> --
> Paul G
> Software engineer.
>
>
> "Mark Rae [MVP]" wrote:
>
>> "Paul"
>> news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
>>
>> > Hi just wondering if running a web application in a single thread is it
>> > possible to add a pause in the code?
>>
>> As others have said, it is possible, but why on earth would you want to
>> deliberately delay a web response...?
>>
>>
>> --
>> Mark Rae
>> ASP.NET MVP
>> http://www.markrae.net
>>
>>
Hi, thanks for the additional information. Yep still trying to figure out
what is going on (the problem) but it does seem to be some type of time out
as using the same code works fine with the same query run for a short date
range vs a failure with the same query and code run for long date ranges.
The document is from the crystal report engine (ReportDocument) so it is one
of the crystal objects that you can use to display a report.
--
Paul G
Software engineer.
"Patrice" wrote:
> IMO it's always best to try first (if not already done) to solve the initial
> problem.
>
> Not sure what kind of document you are talking about. If using automation
> note that some products are not intended for server side use. You also have
> a script timeout that prevent long running pages etc etc...
>
> For now it lloks like the object that represent this document doesn't exists
> (for example if the document is already opened, opending another instance of
> it could perhaps fails).
>
> --
> Patrice
>
> "Paul"
> D8E5C645-AB66-4B7C-8B3F-1BE4B9123CD4@microsoft.com...
> > thanks for the responses, I have some sort of timeout issue I think but it
> > does seem like slowing the web response may not be a solution. I have a
> > document that is used in Crystal reports and on the method document.close
> > I
> > get the error,
> > object not set to an instance of an object, like it has not been
> > instantiated. Works fine for short queries under a minute or so and only
> > occurs on long queries, were data is processed for several years. Also
> > not
> > sure if crystal report has some sort of default timeout if it is waiting
> > for
> > something.
> > --
> > Paul G
> > Software engineer.
> >
> >
> > "Mark Rae [MVP]" wrote:
> >
> >> "Paul"
> >> news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
> >>
> >> > Hi just wondering if running a web application in a single thread is it
> >> > possible to add a pause in the code?
> >>
> >> As others have said, it is possible, but why on earth would you want to
> >> deliberately delay a web response...?
> >>
> >>
> >> --
> >> Mark Rae
> >> ASP.NET MVP
> >> http://www.markrae.net
> >>
> >>
>
>
>
Have you tried to test if the object is null or nothing (depending on the
language you are using ?) right after the creation function ?
I'm not using Crystal Report myself. Hopefully someone that is using it will
enter. You may want to start a new thread as the subject totally changed
;-).
Posting the smallest possible sample code that shows your problem may also
help all along with the exact error message (including perhaps the call
stack so that we can see if this is in your own code or if something could
be wrong in the thrid party code). Surely some CrystalReports users have
long queries....
Good luck.
--
Patrice
"Paul"
99D95313-7246-43A9-AC76-009EB19D2D26@microsoft.com...
> Hi, thanks for the additional information. Yep still trying to figure out
> what is going on (the problem) but it does seem to be some type of time
> out
> as using the same code works fine with the same query run for a short date
> range vs a failure with the same query and code run for long date ranges.
> The document is from the crystal report engine (ReportDocument) so it is
> one
> of the crystal objects that you can use to display a report.
> --
> Paul G
> Software engineer.
>
>
> "Patrice" wrote:
>
>> IMO it's always best to try first (if not already done) to solve the
>> initial
>> problem.
>>
>> Not sure what kind of document you are talking about. If using automation
>> note that some products are not intended for server side use. You also
>> have
>> a script timeout that prevent long running pages etc etc...
>>
>> For now it lloks like the object that represent this document doesn't
>> exists
>> (for example if the document is already opened, opending another instance
>> of
>> it could perhaps fails).
>>
>> --
>> Patrice
>>
>> "Paul"
>> D8E5C645-AB66-4B7C-8B3F-1BE4B9123CD4@microsoft.com...
>> > thanks for the responses, I have some sort of timeout issue I think but
>> > it
>> > does seem like slowing the web response may not be a solution. I have
>> > a
>> > document that is used in Crystal reports and on the method
>> > document.close
>> > I
>> > get the error,
>> > object not set to an instance of an object, like it has not been
>> > instantiated. Works fine for short queries under a minute or so and
>> > only
>> > occurs on long queries, were data is processed for several years. Also
>> > not
>> > sure if crystal report has some sort of default timeout if it is
>> > waiting
>> > for
>> > something.
>> > --
>> > Paul G
>> > Software engineer.
>> >
>> >
>> > "Mark Rae [MVP]" wrote:
>> >
>> >> "Paul"
>> >> news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
>> >>
>> >> > Hi just wondering if running a web application in a single thread is
>> >> > it
>> >> > possible to add a pause in the code?
>> >>
>> >> As others have said, it is possible, but why on earth would you want
>> >> to
>> >> deliberately delay a web response...?
>> >>
>> >>
>> >> --
>> >> Mark Rae
>> >> ASP.NET MVP
>> >> http://www.markrae.net
>> >>
>> >>
>>
>>
>>
thanks for the additional information. It looks like I have a
response.redirect and the object gets set just before this, so for a short
query the object is fine but for the longer query the object goes null after
the response.redirect!
--
Paul G
Software engineer.
"Patrice" wrote:
> Have you tried to test if the object is null or nothing (depending on the
> language you are using ?) right after the creation function ?
> I'm not using Crystal Report myself. Hopefully someone that is using it will
> enter. You may want to start a new thread as the subject totally changed
> ;-).
>
> Posting the smallest possible sample code that shows your problem may also
> help all along with the exact error message (including perhaps the call
> stack so that we can see if this is in your own code or if something could
> be wrong in the thrid party code). Surely some CrystalReports users have
> long queries....
>
> Good luck.
>
> --
> Patrice
>
> "Paul"
> 99D95313-7246-43A9-AC76-009EB19D2D26@microsoft.com...
> > Hi, thanks for the additional information. Yep still trying to figure out
> > what is going on (the problem) but it does seem to be some type of time
> > out
> > as using the same code works fine with the same query run for a short date
> > range vs a failure with the same query and code run for long date ranges.
> > The document is from the crystal report engine (ReportDocument) so it is
> > one
> > of the crystal objects that you can use to display a report.
> > --
> > Paul G
> > Software engineer.
> >
> >
> > "Patrice" wrote:
> >
> >> IMO it's always best to try first (if not already done) to solve the
> >> initial
> >> problem.
> >>
> >> Not sure what kind of document you are talking about. If using automation
> >> note that some products are not intended for server side use. You also
> >> have
> >> a script timeout that prevent long running pages etc etc...
> >>
> >> For now it lloks like the object that represent this document doesn't
> >> exists
> >> (for example if the document is already opened, opending another instance
> >> of
> >> it could perhaps fails).
> >>
> >> --
> >> Patrice
> >>
> >> "Paul"
> >> D8E5C645-AB66-4B7C-8B3F-1BE4B9123CD4@microsoft.com...
> >> > thanks for the responses, I have some sort of timeout issue I think but
> >> > it
> >> > does seem like slowing the web response may not be a solution. I have
> >> > a
> >> > document that is used in Crystal reports and on the method
> >> > document.close
> >> > I
> >> > get the error,
> >> > object not set to an instance of an object, like it has not been
> >> > instantiated. Works fine for short queries under a minute or so and
> >> > only
> >> > occurs on long queries, were data is processed for several years. Also
> >> > not
> >> > sure if crystal report has some sort of default timeout if it is
> >> > waiting
> >> > for
> >> > something.
> >> > --
> >> > Paul G
> >> > Software engineer.
> >> >
> >> >
> >> > "Mark Rae [MVP]" wrote:
> >> >
> >> >> "Paul"
> >> >> news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
> >> >>
> >> >> > Hi just wondering if running a web application in a single thread is
> >> >> > it
> >> >> > possible to add a pause in the code?
> >> >>
> >> >> As others have said, it is possible, but why on earth would you want
> >> >> to
> >> >> deliberately delay a web response...?
> >> >>
> >> >>
> >> >> --
> >> >> Mark Rae
> >> >> ASP.NET MVP
> >> >> http://www.markrae.net
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Discovered the problem, the object was being saved in a session variable and
someone had added a session timeout of 1 minute to the web.config file
therefore the session variable was timing out.
thanks.
--
Paul G
Software engineer.
"Patrice" wrote:
> Have you tried to test if the object is null or nothing (depending on the
> language you are using ?) right after the creation function ?
> I'm not using Crystal Report myself. Hopefully someone that is using it will
> enter. You may want to start a new thread as the subject totally changed
> ;-).
>
> Posting the smallest possible sample code that shows your problem may also
> help all along with the exact error message (including perhaps the call
> stack so that we can see if this is in your own code or if something could
> be wrong in the thrid party code). Surely some CrystalReports users have
> long queries....
>
> Good luck.
>
> --
> Patrice
>
> "Paul"
> 99D95313-7246-43A9-AC76-009EB19D2D26@microsoft.com...
> > Hi, thanks for the additional information. Yep still trying to figure out
> > what is going on (the problem) but it does seem to be some type of time
> > out
> > as using the same code works fine with the same query run for a short date
> > range vs a failure with the same query and code run for long date ranges.
> > The document is from the crystal report engine (ReportDocument) so it is
> > one
> > of the crystal objects that you can use to display a report.
> > --
> > Paul G
> > Software engineer.
> >
> >
> > "Patrice" wrote:
> >
> >> IMO it's always best to try first (if not already done) to solve the
> >> initial
> >> problem.
> >>
> >> Not sure what kind of document you are talking about. If using automation
> >> note that some products are not intended for server side use. You also
> >> have
> >> a script timeout that prevent long running pages etc etc...
> >>
> >> For now it lloks like the object that represent this document doesn't
> >> exists
> >> (for example if the document is already opened, opending another instance
> >> of
> >> it could perhaps fails).
> >>
> >> --
> >> Patrice
> >>
> >> "Paul"
> >> D8E5C645-AB66-4B7C-8B3F-1BE4B9123CD4@microsoft.com...
> >> > thanks for the responses, I have some sort of timeout issue I think but
> >> > it
> >> > does seem like slowing the web response may not be a solution. I have
> >> > a
> >> > document that is used in Crystal reports and on the method
> >> > document.close
> >> > I
> >> > get the error,
> >> > object not set to an instance of an object, like it has not been
> >> > instantiated. Works fine for short queries under a minute or so and
> >> > only
> >> > occurs on long queries, were data is processed for several years. Also
> >> > not
> >> > sure if crystal report has some sort of default timeout if it is
> >> > waiting
> >> > for
> >> > something.
> >> > --
> >> > Paul G
> >> > Software engineer.
> >> >
> >> >
> >> > "Mark Rae [MVP]" wrote:
> >> >
> >> >> "Paul"
> >> >> news:3390C908-BC95-4660-940D-F618F45E706D@microsoft.com...
> >> >>
> >> >> > Hi just wondering if running a web application in a single thread is
> >> >> > it
> >> >> > possible to add a pause in the code?
> >> >>
> >> >> As others have said, it is possible, but why on earth would you want
> >> >> to
> >> >> deliberately delay a web response...?
> >> >>
> >> >>
> >> >> --
> >> >> Mark Rae
> >> >> ASP.NET MVP
> >> >> http://www.markrae.net
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>