Web Service (or Timer) Randomly Ending


P

philaphan80

I've built a .NET 2.0 web service and tied it into an ASP.NET 2.0 web
application. The service includes a System.Timers.Timer that logs an
entry to a SQL 2000 database every minute (60000 ms).

Both were running fine within Visual Studio's native server on my
local machine. Even after I closed the web page that triggered the
service's timer to run, the timer would log entries indefinitely
until
I recompiled the code, changed the web.config file, or restarted the
IIS service (as expected).

I've now deployed the web service to a shared hosting environment
(IIS
is now out of my control) and I'm noticing that either the service
*or* the timer are ending prematurely. Unfortunately, I haven't been
able to find a pattern since it seems to end one time after 4
minutes,
the next 13, the next 7, etc. I'm not doing anything fancy here --
just writing to a log. And I've added no new functionality between
local testing and deployment.

I'm able to log some events via Global.asax, but the service's
"Application_End" event never seems to fire. This is what makes me
suspect the timer as a possible culprit (hunch: service doesn't end,
but timer does for some reason).

First of all, is it possible for a timer to end while the service
still runs? If so, is there an event or something I can trap to
write
something to my log *before* it ends? That will help me track this
down better.

Secondly, could an IIS setting in the shared environment (app pool?)
be ending my service at random times? If so, any way to trap / work
around it?

I'm open to any insight or guidance.....
 
Ad

Advertisements


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

Top