Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting .NET service in IIS (No Interface)

Tags:

I've written a small application that simply has a timer that polls a database on a tick. When specific entries are found, it does a bit of processing.

Currently this is written in C# and hosted in a Windows Service.

Many of my team's other, more "interactive" services are being moved to being centrally hosted in IIS. For consistency, I was asked to convert my service to be hosted in IIS.

Is it possible to host a service that has no Interface in IIS? I'm used to seeing OnStart and OnStop methods, are those still available when hosted this way?

like image 711
80bower Avatar asked Jan 29 '10 14:01

80bower


1 Answers

Until IIS 7.5, services hosted in IIS are activation-based - that is, they only run when requested. For performance reasons, they stay running for a while after that, but there's no guarantee that they will be running at all.

For a service like yours, IIS hosting doesn't sound like a particularly good idea. If it's never requested, it's never going to run.

like image 76
Mark Seemann Avatar answered Nov 15 '22 07:11

Mark Seemann