Testing a service - VB.NET

  • Thread starter Thread starter NWx
  • Start date Start date
N

NWx

Hi,

I try to write my first service, but I cannot test it

Service is a simple test one, just write a message in eventlog on start and
on exit

I tried to install it with installutil, it ask me to enter username /
password / verify password, and after I entered something, and I got the
following error message:

An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: The account name is invalid or does
not ex
ist, or the password is invalid for the account name specified

The service contains only two files

1. main service source module (with the code below)

Protected Overrides Sub OnStart(ByVal args() As String)

' read connection string for database access

InitServiceSettings()

InsurTimer.Start()

EventLog.WriteEntry("InsurService timer started")

End Sub

Protected Overrides Sub OnStop()

' Add code here to perform any tear-down necessary to stop your service.

InsurTimer.Stop()

EventLog.WriteEntry("InsurService timer stopped")

End Sub

Private Sub InitServiceSettings()

Me.cConnectionString =
ConfigurationSettings.AppSettings(Me.CfgKeyConnString)

InsurTimer.Interval =
CLng(ConfigurationSettings.AppSettings(Me.CfgKeyTimerInterval))

Me.cSMTPMailServer = ConfigurationSettings.AppSettings(Me.CfgKeySMTPServer)

EventLog.WriteEntry("InsurService setup")

End Sub



And a file ProjectInstaller.vb, only with its default code



Can anyone tell me what should I do?



Thank you
 
Hi
Check the account under which you are running the service.Try to give LocalSystem in your service installer and after that install the service.It should work.Also to debug the web service,start the service,Put a break point in the web service code and then go to Debug->Processes and attach to the process(select the exe name of your service).
 
Thank you for your help.


manish said:
Hi,
Check the account under which you are running the service.Try to give
LocalSystem in your service installer and after that install the service.It
should work.Also to debug the web service,start the service,Put a break
point in the web service code and then go to Debug->Processes and attach to
the process(select the exe name of your service).
 
Attach a Debugger like VS.net if you can.
Add debug your service.

Be sure to be a part of DebuggerUsers group in the machine where the process
is executed.
 
Back
Top