Does anyone know of a macro or way of enabling Windows service projects to be created in VB.NET standard? Thomas Erdösi has written a fantastic macro to enable new projects to be compiled to dll's.
If not the would someone be kind enough to create a new blank windows service project for me?
I've created a service and installer and installed my service. It show up in the list of services now but when trying to start it it takes too long and the status is stuck on starting.
I haven't written any services, but it seems very likely that you need to investigate the ServiceController component:
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemserviceprocessservicecontrollerclasstopic.htm
"Represents a Windows service and allows you to connect to a running or stopped service, manipulate it, or get information about it."
That isn't what you wanted at all, is it. I'm trying to figure out service installation/removal also, or maybe someone else already has done it and will post your answer.
Got it. Read:
ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbwlkwalkthroughcreatingwindowsserviceapplication.htm
I followed its instructions exactly and was rewarded with the following attached project. The output of the project (two projects actually) is a) a service and b) an installer package. I ran the installer package, my toy service showed up in the services list (right-click My Computer -> Manage...) and the service started/stopped, as well as stuck an event in the event log.
Something a bit tricky (although you sound like you got past this: When you provide username/password, if you are installing on your local machine, the format for username is COMPUTERNAME\username.
TcpListener is kind of out of my bailiwick. Have you read:
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemNetSocketsTcpListenerClassTopic.htm
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemnetsocketstcpclientclassgetstreamtopic.htm
and
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemnetsocketsnetworkstreammemberstopic.htm
From the example it looks you're using a different way of dealing with TcpListener though, so these may not be helpful. I have no idea beyond that.
As to why your logging isn't working, why don't you put something in your exception handler to write an event log entry on a catch. Not sure why that's giving you trouble.
As for Application.StartupPath, it works fine in a service (just tested it). The trick is to add a reference to System.Windows.Forms.dll in the Project menu -> Add Reference...