spuppett
spuppett

Reputation: 557

httpListener as a windows service

I have an httpListener exe that is working great. What I need to do now is make it a service (I think) so that when the server is rebooted, this program will start automatically. I found a few tutorials for making services and I got one installed, but when I started it, it said it took to long to respond. I was thinking that might be because I have a while true loop going in the onStart method.

Anyone have any thoughts?

Upvotes: 0

Views: 1504

Answers (2)

steinar
steinar

Reputation: 9653

It's impossible to answer this question directly without more information (e.g. on what exactly you're doing). However, that should not be necessary as you should be able to debug it yourself by attaching the debugger to the running service, as explained here.

Upvotes: 0

heathen world
heathen world

Reputation: 150

if the service onStart event just dives into business logic, the event never ends, so the service does not complete startup. I don't have a VB.NET example, but my approach has been to create a timer in IniializeComponent event, complete with a smallish interval and wire up of a timer.elapsed event.

The OnStart event then has one line of code in it to start the timer. The service startup completes, then the service starts getting to work when the Timer.Elapsed event fires.

Upvotes: 1

Related Questions