Showing posts with label service. Show all posts
Showing posts with label service. Show all posts

Monday, March 26, 2012

This is what my hosting service said

"Although we do support the ASP.NET Starter Kits, we do not do the
installation for you. You can run the installation file locally, then
upload the kit. You will not be able to compile on the server. You will be
able to set your .NET virtual directories through our web based control
panel. This same support is available for DotNetNuke. We support the
application, but not the installation.

Please let us know if you have additional questions."

-------------------

Questions....

What do they mean that I can't compile on the server?? What file types are
involved (.aspx , ascx)?

Now, what can and can't I do in ASP.net with this hosting service?

In ASP.net which files types are (precompiled)? Which are interpreted
(embedded wtth HTML code)?

ThanksHello jty202,

What they are saying is that you need to download the starter kits, and do
the compilation process yourself.

On compilation you will produce dlls in your bin directory (if using Visual
Studio). The dll contains all the code from your code behinds.

Once you have the dlls the only other thing you need are all the aspx pages
and images and so on. You don't need to upload the code behing files but
you could if you wanted.

So, they are asking you to do the compile by yourself and then upload the
dll produced along with the aspx pages.

I think ;-)

HTH

tce

> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You
> will be able to set your .NET virtual directories through our web
> based control panel. This same support is available for DotNetNuke.
> We support the application, but not the installation.
> Please let us know if you have additional questions."
> -------------------
> Questions....
> What do they mean that I can't compile on the server?? What file
> types are involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
> Thanks
All files in ASP.NET (1.x) are compiled on first use.
Assembly files used in web apps are deployed as binary DLL so they don't
need compilation.
DotNetNuke build the database on first access so my guess is that you don't
have any limitation with your hosting service.

Lionel.

"jty202" <jty202@.gmail.com> a crit dans le message de news:
u9L%23YH$%23EHA.2192@.TK2MSFTNGP14.phx.gbl...
> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You will
> be
> able to set your .NET virtual directories through our web based control
> panel. This same support is available for DotNetNuke. We support the
> application, but not the installation.
> Please let us know if you have additional questions."
> -------------------
> Questions....
> What do they mean that I can't compile on the server?? What file types
> are
> involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
>
> Thanks
That sounds about right.

You won't be able to use their compiler to
build your dlls. You'll have to do that locally.

You'll then upload your assemblies to the /bin directory,
and your aspx, ascx and other support files to
the appropiate directories.

All your pages *will* get JIT-compiled by them, though.
The net result will work as advertised : compiled pages.

Just not compiled dll's. Those you will compile yourself.

Juan T. Llibre
ASP.NET MVP
===========
"jty202" <jty202@.gmail.com> wrote in message
news:u9L%23YH$%23EHA.2192@.TK2MSFTNGP14.phx.gbl...
> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You will
> be
> able to set your .NET virtual directories through our web based control
> panel. This same support is available for DotNetNuke. We support the
> application, but not the installation.
> Please let us know if you have additional questions."
> -------------------
> Questions....
> What do they mean that I can't compile on the server?? What file types
> are
> involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
>
> Thanks
When I compile the code behind as dll and upload it...

Do I need to tell my webhost to register the dlls? If so, they are gonna
charge extra...

The more I think about it... the more I should stick with PHP >.. LOL

"thechaosengine" <na> wrote in message
news:4349632414942902112208@.news.microsoft.com...
> Hello jty202,
> What they are saying is that you need to download the starter kits, and do
> the compilation process yourself.
> On compilation you will produce dlls in your bin directory (if using
Visual
> Studio). The dll contains all the code from your code behinds.
> Once you have the dlls the only other thing you need are all the aspx
pages
> and images and so on. You don't need to upload the code behing files but
> you could if you wanted.
> So, they are asking you to do the compile by yourself and then upload the
> dll produced along with the aspx pages.
> I think ;-)
> HTH
> tce
>
> > "Although we do support the ASP.NET Starter Kits, we do not do the
> > installation for you. You can run the installation file locally, then
> > upload the kit. You will not be able to compile on the server. You
> > will be able to set your .NET virtual directories through our web
> > based control panel. This same support is available for DotNetNuke.
> > We support the application, but not the installation.
> > Please let us know if you have additional questions."
> > -------------------
> > Questions....
> > What do they mean that I can't compile on the server?? What file
> > types are involved (.aspx , ascx)?
> > Now, what can and can't I do in ASP.net with this hosting service?
> > In ASP.net which files types are (precompiled)? Which are interpreted
> > (embedded wtth HTML code)?
> > Thanks
Just think of it as uploading a compiled application.

> The more I think about it... the more I should stick with PHP
Yeah, well, the 70s were great, man, weren't they ?

> .. LOL
>
> "thechaosengine" <na> wrote in message
> news:4349632414942902112208@.news.microsoft.com...
>> Hello jty202,
>>
>> What they are saying is that you need to download the starter kits, and
>> do the compilation process yourself.
>>
>> On compilation you will produce dlls in your bin directory (if using
> Visual
>> Studio). The dll contains all the code from your code behinds.
>>
>> Once you have the dlls the only other thing you need are all the aspx
> pages
>> and images and so on. You don't need to upload the code behing files but
>> you could if you wanted.
>>
>> So, they are asking you to do the compile by yourself and then upload the
>> dll produced along with the aspx pages.
>>
>> I think ;-)
>>
>> HTH
>>
>> tce
>>
>>
>> > "Although we do support the ASP.NET Starter Kits, we do not do the
>> > installation for you. You can run the installation file locally, then
>> > upload the kit. You will not be able to compile on the server. You
>> > will be able to set your .NET virtual directories through our web
>> > based control panel. This same support is available for DotNetNuke.
>> > We support the application, but not the installation.
>>> > Please let us know if you have additional questions."
>>> > -------------------
>>> > Questions....
>>> > What do they mean that I can't compile on the server?? What file
>> > types are involved (.aspx , ascx)?
>>> > Now, what can and can't I do in ASP.net with this hosting service?
>>> > In ASP.net which files types are (precompiled)? Which are interpreted
>> > (embedded wtth HTML code)?
>>> > Thanks
>>>
>
--

http://texeme.com
Textcasting Technology
Hello jty202,

Your ISP shouldnt have to register the dlls. I've deployed lots of applications
on many servers and the only registering I've done - very occasionally is
when I wanted to share a single dll between two or more different applications.

Most of the time, dotnet applications are deployed in self contained folders
- including asp.net sites.

My best advice would be to "acquire" visual stuido or the web matrix application
and have a look at what it does.

Essentially the main difference between php and asp.net is that the logic
statements more often than not should go into the codebehind classes - one
code behind for each aspx page. This has the very sought after advantage
of keeping html in a UI file and logic in a logic file (*.cs, *.vb)

Get yourself a book or your going to be scratching your head a lot. Its really
not that hard though. I promise.

and it is better than php in my humble opinion. Much Better ;-)

Take Care

> When I compile the code behind as dll and upload it...
> Do I need to tell my webhost to register the dlls? If so, they are
> gonna charge extra...
> The more I think about it... the more I should stick with PHP >.. LOL
> "thechaosengine" <na> wrote in message
> news:4349632414942902112208@.news.microsoft.com...
>> Hello jty202,
>>
>> What they are saying is that you need to download the starter kits,
>> and do the compilation process yourself.
>>
>> On compilation you will produce dlls in your bin directory (if using
>>
> Visual
>> Studio). The dll contains all the code from your code behinds.
>>
>> Once you have the dlls the only other thing you need are all the aspx
>>
> pages
>> and images and so on. You don't need to upload the code behing files
>> but you could if you wanted.
>>
>> So, they are asking you to do the compile by yourself and then upload
>> the dll produced along with the aspx pages.
>>
>> I think ;-)
>>
>> HTH
>>
>> tce
>>
>>> "Although we do support the ASP.NET Starter Kits, we do not do the
>>> installation for you. You can run the installation file locally,
>>> then upload the kit. You will not be able to compile on the server.
>>> You will be able to set your .NET virtual directories through our
>>> web based control panel. This same support is available for
>>> DotNetNuke. We support the application, but not the installation.
>>>
>>> Please let us know if you have additional questions."
>>>
>>> -------------------
>>>
>>> Questions....
>>>
>>> What do they mean that I can't compile on the server?? What file
>>> types are involved (.aspx , ascx)?
>>>
>>> Now, what can and can't I do in ASP.net with this hosting service?
>>>
>>> In ASP.net which files types are (precompiled)? Which are
>>> interpreted (embedded wtth HTML code)?
>>>
>>> Thanks
>>
Which starter kit are you thinking of using?

The Community Starter Kit does, unfortunately, require some amount of configuration
on the server - most notably the IIS script mappings have to change in order
for .jpg and .gif requests to route to the ASP.NET runtime (some images are
served by the app from the database). Unless thier control panel supports
script map editing you'll need to find another host. Many other hosts are
familar with the startker kits and offer free installation.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You
> will be able to set your .NET virtual directories through our web
> based control panel. This same support is available for DotNetNuke.
> We support the application, but not the installation.
> Please let us know if you have additional questions."
> -------------------
> Questions....
> What do they mean that I can't compile on the server?? What file
> types are involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
> Thanks

This is what my hosting service said

"Although we do support the ASP.NET Starter Kits, we do not do the
installation for you. You can run the installation file locally, then
upload the kit. You will not be able to compile on the server. You will be
able to set your .NET virtual directories through our web based control
panel. This same support is available for DotNetNuke. We support the
application, but not the installation.
Please let us know if you have additional questions."
---
Questions....
What do they mean that I can't compile on the server' What file types are
involved (.aspx , ascx)?
Now, what can and can't I do in ASP.net with this hosting service?
In ASP.net which files types are (precompiled)? Which are interpreted
(embedded wtth HTML code)?
ThanksHello jty202,
What they are saying is that you need to download the starter kits, and do
the compilation process yourself.
On compilation you will produce dlls in your bin directory (if using Visual
Studio). The dll contains all the code from your code behinds.
Once you have the dlls the only other thing you need are all the aspx pages
and images and so on. You don't need to upload the code behing files but
you could if you wanted.
So, they are asking you to do the compile by yourself and then upload the
dll produced along with the aspx pages.
I think ;-)
HTH
tce

> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You
> will be able to set your .NET virtual directories through our web
> based control panel. This same support is available for DotNetNuke.
> We support the application, but not the installation.
> Please let us know if you have additional questions."
> ---
> Questions....
> What do they mean that I can't compile on the server' What file
> types are involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
> Thanks
>
All files in ASP.NET (1.x) are compiled on first use.
Assembly files used in web apps are deployed as binary DLL so they don't
need compilation.
DotNetNuke build the database on first access so my guess is that you don't
have any limitation with your hosting service.
Lionel.
"jty202" <jty202@.gmail.com> a crit dans le message de news:
u9L%23YH$%23EHA.2192@.TK2MSFTNGP14.phx.gbl...
> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You will
> be
> able to set your .NET virtual directories through our web based control
> panel. This same support is available for DotNetNuke. We support the
> application, but not the installation.
> Please let us know if you have additional questions."
> ---
> Questions....
> What do they mean that I can't compile on the server' What file types
> are
> involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
>
> Thanks
>
That sounds about right.
You won't be able to use their compiler to
build your dlls. You'll have to do that locally.
You'll then upload your assemblies to the /bin directory,
and your aspx, ascx and other support files to
the appropiate directories.
All your pages *will* get JIT-compiled by them, though.
The net result will work as advertised : compiled pages.
Just not compiled dll's. Those you will compile yourself.
Juan T. Llibre
ASP.NET MVP
===========
"jty202" <jty202@.gmail.com> wrote in message
news:u9L%23YH$%23EHA.2192@.TK2MSFTNGP14.phx.gbl...
> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You will
> be
> able to set your .NET virtual directories through our web based control
> panel. This same support is available for DotNetNuke. We support the
> application, but not the installation.
> Please let us know if you have additional questions."
> ---
> Questions....
> What do they mean that I can't compile on the server' What file types
> are
> involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
>
> Thanks
>
When I compile the code behind as dll and upload it...
Do I need to tell my webhost to register the dlls? If so, they are gonna
charge extra...
The more I think about it... the more I should stick with PHP >.. LOL
"thechaosengine" <na> wrote in message
news:4349632414942902112208@.news.microsoft.com...
> Hello jty202,
> What they are saying is that you need to download the starter kits, and do
> the compilation process yourself.
> On compilation you will produce dlls in your bin directory (if using
Visual
> Studio). The dll contains all the code from your code behinds.
> Once you have the dlls the only other thing you need are all the aspx
pages
> and images and so on. You don't need to upload the code behing files but
> you could if you wanted.
> So, they are asking you to do the compile by yourself and then upload the
> dll produced along with the aspx pages.
> I think ;-)
> HTH
> tce
>
>
Just think of it as uploading a compiled application.

> The more I think about it... the more I should stick with PHP >
Yeah, well, the 70s were great, man, weren't they ?
> .. LOL
>
> "thechaosengine" <na> wrote in message
> news:4349632414942902112208@.news.microsoft.com...
> Visual
> pages
http://texeme.com
Textcasting Technology
Hello jty202,
Your ISP shouldnt have to register the dlls. I've deployed lots of applicati
ons
on many servers and the only registering I've done - very occasionally is
when I wanted to share a single dll between two or more different applicatio
ns.
Most of the time, dotnet applications are deployed in self contained folders
- including asp.net sites.
My best advice would be to "acquire" visual stuido or the web matrix applica
tion
and have a look at what it does.
Essentially the main difference between php and asp.net is that the logic
statements more often than not should go into the codebehind classes - one
code behind for each aspx page. This has the very sought after advantage
of keeping html in a UI file and logic in a logic file (*.cs, *.vb)
Get yourself a book or your going to be scratching your head a lot. Its real
ly
not that hard though. I promise.
and it is better than php in my humble opinion. Much Better ;-)
Take Care
> When I compile the code behind as dll and upload it...
> Do I need to tell my webhost to register the dlls? If so, they are
> gonna charge extra...
> The more I think about it... the more I should stick with PHP >.. LOL
> "thechaosengine" <na> wrote in message
> news:4349632414942902112208@.news.microsoft.com...
> Visual
>
> pages
>
Which starter kit are you thinking of using?
The Community Starter Kit does, unfortunately, require some amount of config
uration
on the server - most notably the IIS script mappings have to change in order
for .jpg and .gif requests to route to the ASP.NET runtime (some images are
served by the app from the database). Unless thier control panel supports
script map editing you'll need to find another host. Many other hosts are
familar with the startker kits and offer free installation.
HTH,
Scott
http://www.OdeToCode.com/blogs/scott/

> "Although we do support the ASP.NET Starter Kits, we do not do the
> installation for you. You can run the installation file locally, then
> upload the kit. You will not be able to compile on the server. You
> will be able to set your .NET virtual directories through our web
> based control panel. This same support is available for DotNetNuke.
> We support the application, but not the installation.
> Please let us know if you have additional questions."
> ---
> Questions....
> What do they mean that I can't compile on the server' What file
> types are involved (.aspx , ascx)?
> Now, what can and can't I do in ASP.net with this hosting service?
> In ASP.net which files types are (precompiled)? Which are interpreted
> (embedded wtth HTML code)?
> Thanks
>

Tuesday, March 13, 2012

Thread timeout

Hi,
I have a long running task that I want to run on a regular basis to do some
db updates. I can't write a windows service because it is being hosted
elsewhere. I want to run this task within my web application - so here is
what I did:
In the global.asax I declared a delegate function and a timer. In the
application start event, I started the timer. I created a method to
respond to the timer event, which creates a new thread and runs the Long
Running Task method:
Private Delegate Function LongRunningTaskTask() As Integer
Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub
Private Sub WakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Try
' Create new thread
Dim AsyncStatePrice As IAsyncResult
' Start the task on a runtime thread asynchronously
Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
LongRunningTaskUpdate)
AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
Nothing)
Dim WaitHandles() As WaitHandle =
{AsyncStatePrice.AsyncWaitHandle}
WaitHandle.WaitAll(WaitHandles)
Catch ex As Exception
'Throw (ex)
End Try
End Sub
The method kicks off fine, but times-out before completion. I want this to
continue running regardless if the person who invoked the application start
event has their browser open or not. Is there a way to increase the
timeout value for the thread through code. I don't want to change the
session timeout for everyone, just this one process. Is there a better
solution?
Thanks
Message posted via http://www.webservertalk.comIt seems you have a long running task, but I don't see where the return
value comes into play.
This might not be the best solution for what you want, but it is something
else to consider. You could use the ThreadPool.QueueUserWorkItem method
that takes a WaitCallBack and an optional object parameter.
ApplicationStart
ThreadPool.QueueUserWorkItem( new WaitCallBack( LongRunningTask ) );
public static void LongRunningTask( object data )
{
//your long running task in here. If you need the user who kicked this off,
you can pass it
//through object data.
}
LongRunningTask will run in a thread from the ThreadPool that .NET
maintains. The timer event also runs from the thread pool. However, this
is a one time, queue this method and run it. It does not have to be a
static (shared) method, but mine typically are. If you need to do something
with the return value, I am sure you could come up with something, or not
even take this approach anyway.
Timers typically are used for recurring tasks, like checking application
state, processing a continuous queue. If you are merely running this task
"on occasion", it probably would be better served using the thread pool.
I just looked and you code is in VB, sorry about my samples.
HTH,
bill
"JeffSinNHUSA via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:85011c9724d646de9be3606d4c960ba2@.Do
webservertalk.com...
> Hi,
> I have a long running task that I want to run on a regular basis to do
some
> db updates. I can't write a windows service because it is being hosted
> elsewhere. I want to run this task within my web application - so here is
> what I did:
> In the global.asax I declared a delegate function and a timer. In the
> application start event, I started the timer. I created a method to
> respond to the timer event, which creates a new thread and runs the Long
> Running Task method:
> Private Delegate Function LongRunningTaskTask() As Integer
> Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub WakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Try
> ' Create new thread
> Dim AsyncStatePrice As IAsyncResult
> ' Start the task on a runtime thread asynchronously
> Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
> LongRunningTaskUpdate)
> AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
> Nothing)
> Dim WaitHandles() As WaitHandle =
> {AsyncStatePrice.AsyncWaitHandle}
> WaitHandle.WaitAll(WaitHandles)
> Catch ex As Exception
> 'Throw (ex)
> End Try
> End Sub
>
> The method kicks off fine, but times-out before completion. I want this
to
> continue running regardless if the person who invoked the application
start
> event has their browser open or not. Is there a way to increase the
> timeout value for the thread through code. I don't want to change the
> session timeout for everyone, just this one process. Is there a better
> solution?
> Thanks
> --
> Message posted via http://www.webservertalk.com
Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks like
it terminates the thread after about 30 seconds.
Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub
Private Sub PricePointsWakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Dim stateInfo As New TaskInfo("Price Points Update", 1)
If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
LongRunningTask), stateInfo) Then
Thread.Sleep(1000)
End If
End Sub
Public Class TaskInfo
Public Boilerplate As String
Public Value As Integer
Public Sub New(ByVal text As String, ByVal number As Integer)
Boilerplate = text
Value = number
End Sub
End Class
Shared Sub LongRunningTask(ByVal stateInfo As Object)
End Sub
Message posted via http://www.webservertalk.com
I did not realize you are wanting to fire your price point method every
600000. I thought you were wanting a queue that you could queue up long
running tasks, and use your timer to clear the queue. You can probably skip
the queue user work item since your timer is called from a thread in the
ThreadPool anyway. My mistake.
How do you know the thread is dying? Is it receiving a
ThreadAbortException. (that means the thread is timing out) or it is a Sql
timeout exception. If a Sql Timeout exception, you could increase the
CommandTimeout on your SqlCommand object.
If you are recieving the ThreadAbortException, you probably will have to
manually create a thread (not from the ThreadPool) to run the long running
task. Your timer shouldn't block waiting for it to complete, but probably
should fire the thread off and then return immediately.
If you need a sample to get a manually created thread off and running let me
know.
Sorry for misunderstanding you and basically giving you the run around. :)
bill
"JeffSinNHUSA via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:4f599a23f948417db07f21a9143b623c@.Do
webservertalk.com...
> Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks
like
> it terminates the thread after about 30 seconds.
>
> Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub PricePointsWakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Dim stateInfo As New TaskInfo("Price Points Update", 1)
> If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
> LongRunningTask), stateInfo) Then
> Thread.Sleep(1000)
> End If
> End Sub
> Public Class TaskInfo
> Public Boilerplate As String
> Public Value As Integer
> Public Sub New(ByVal text As String, ByVal number As Integer)
> Boilerplate = text
> Value = number
> End Sub
> End Class
> Shared Sub LongRunningTask(ByVal stateInfo As Object)
> End Sub
> --
> Message posted via http://www.webservertalk.com
No problem on the advice - I learned something new.
So back to the old code. I threw try catch blocks around everything, and
instead of throwing an exception, I emailed myself the esception info. I
also email myself as it loops thru the data it is processing. After about
6 iterations (which takes about 60 seconds) I stop receiving emails. Looks
like an exception isn't being thrown.
Message posted via http://www.webservertalk.com

Thread timeout

Hi,

I have a long running task that I want to run on a regular basis to do some
db updates. I can't write a windows service because it is being hosted
elsewhere. I want to run this task within my web application - so here is
what I did:

In the global.asax I declared a delegate function and a timer. In the
application start event, I started the timer. I created a method to
respond to the timer event, which creates a new thread and runs the Long
Running Task method:

Private Delegate Function LongRunningTaskTask() As Integer
Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub

Private Sub WakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Try
' Create new thread
Dim AsyncStatePrice As IAsyncResult
' Start the task on a runtime thread asynchronously
Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
LongRunningTaskUpdate)

AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
Nothing)

Dim WaitHandles() As WaitHandle =
{AsyncStatePrice.AsyncWaitHandle}
WaitHandle.WaitAll(WaitHandles)

Catch ex As Exception
'Throw (ex)
End Try
End Sub

The method kicks off fine, but times-out before completion. I want this to
continue running regardless if the person who invoked the application start
event has their browser open or not. Is there a way to increase the
timeout value for the thread through code. I don't want to change the
session timeout for everyone, just this one process. Is there a better
solution?

Thanks

--
Message posted via http://www.dotnetmonster.comIt seems you have a long running task, but I don't see where the return
value comes into play.

This might not be the best solution for what you want, but it is something
else to consider. You could use the ThreadPool.QueueUserWorkItem method
that takes a WaitCallBack and an optional object parameter.

ApplicationStart

ThreadPool.QueueUserWorkItem( new WaitCallBack( LongRunningTask ) );

public static void LongRunningTask( object data )
{
//your long running task in here. If you need the user who kicked this off,
you can pass it
//through object data.
}

LongRunningTask will run in a thread from the ThreadPool that .NET
maintains. The timer event also runs from the thread pool. However, this
is a one time, queue this method and run it. It does not have to be a
static (shared) method, but mine typically are. If you need to do something
with the return value, I am sure you could come up with something, or not
even take this approach anyway.

Timers typically are used for recurring tasks, like checking application
state, processing a continuous queue. If you are merely running this task
"on occasion", it probably would be better served using the thread pool.

I just looked and you code is in VB, sorry about my samples.

HTH,

bill

"JeffSinNHUSA via DotNetMonster.com" <forum@.DotNetMonster.com> wrote in
message news:85011c9724d646de9be3606d4c960ba2@.DotNetMonste r.com...
> Hi,
> I have a long running task that I want to run on a regular basis to do
some
> db updates. I can't write a windows service because it is being hosted
> elsewhere. I want to run this task within my web application - so here is
> what I did:
> In the global.asax I declared a delegate function and a timer. In the
> application start event, I started the timer. I created a method to
> respond to the timer event, which creates a new thread and runs the Long
> Running Task method:
> Private Delegate Function LongRunningTaskTask() As Integer
> Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub WakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Try
> ' Create new thread
> Dim AsyncStatePrice As IAsyncResult
> ' Start the task on a runtime thread asynchronously
> Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
> LongRunningTaskUpdate)
> AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
> Nothing)
> Dim WaitHandles() As WaitHandle =
> {AsyncStatePrice.AsyncWaitHandle}
> WaitHandle.WaitAll(WaitHandles)
> Catch ex As Exception
> 'Throw (ex)
> End Try
> End Sub
>
> The method kicks off fine, but times-out before completion. I want this
to
> continue running regardless if the person who invoked the application
start
> event has their browser open or not. Is there a way to increase the
> timeout value for the thread through code. I don't want to change the
> session timeout for everyone, just this one process. Is there a better
> solution?
> Thanks
> --
> Message posted via http://www.dotnetmonster.com
Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks like
it terminates the thread after about 30 seconds.

Private WithEvents ServiceTimer As New System.Timers.Timer(600000)

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub

Private Sub PricePointsWakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Dim stateInfo As New TaskInfo("Price Points Update", 1)
If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
LongRunningTask), stateInfo) Then

Thread.Sleep(1000)

End If
End Sub

Public Class TaskInfo
Public Boilerplate As String
Public Value As Integer

Public Sub New(ByVal text As String, ByVal number As Integer)
Boilerplate = text
Value = number
End Sub
End Class

Shared Sub LongRunningTask(ByVal stateInfo As Object)

End Sub

--
Message posted via http://www.dotnetmonster.com
I did not realize you are wanting to fire your price point method every
600000. I thought you were wanting a queue that you could queue up long
running tasks, and use your timer to clear the queue. You can probably skip
the queue user work item since your timer is called from a thread in the
ThreadPool anyway. My mistake.

How do you know the thread is dying? Is it receiving a
ThreadAbortException. (that means the thread is timing out) or it is a Sql
timeout exception. If a Sql Timeout exception, you could increase the
CommandTimeout on your SqlCommand object.

If you are recieving the ThreadAbortException, you probably will have to
manually create a thread (not from the ThreadPool) to run the long running
task. Your timer shouldn't block waiting for it to complete, but probably
should fire the thread off and then return immediately.

If you need a sample to get a manually created thread off and running let me
know.

Sorry for misunderstanding you and basically giving you the run around. :)

bill

"JeffSinNHUSA via DotNetMonster.com" <forum@.DotNetMonster.com> wrote in
message news:4f599a23f948417db07f21a9143b623c@.DotNetMonste r.com...
> Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks
like
> it terminates the thread after about 30 seconds.
>
> Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub PricePointsWakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Dim stateInfo As New TaskInfo("Price Points Update", 1)
> If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
> LongRunningTask), stateInfo) Then
> Thread.Sleep(1000)
> End If
> End Sub
> Public Class TaskInfo
> Public Boilerplate As String
> Public Value As Integer
> Public Sub New(ByVal text As String, ByVal number As Integer)
> Boilerplate = text
> Value = number
> End Sub
> End Class
> Shared Sub LongRunningTask(ByVal stateInfo As Object)
> End Sub
> --
> Message posted via http://www.dotnetmonster.com
No problem on the advice - I learned something new.

So back to the old code. I threw try catch blocks around everything, and
instead of throwing an exception, I emailed myself the esception info. I
also email myself as it loops thru the data it is processing. After about
6 iterations (which takes about 60 seconds) I stop receiving emails. Looks
like an exception isn't being thrown.

--
Message posted via http://www.dotnetmonster.com