vb.net service debug start error

  • Thread starter Thread starter SiD`
  • Start date Start date
S

SiD`

when starting a windows service writte in vb.net, a messagebox appears:

cannot start service from the command line or a debugger. A windows
service must first be installed using installutil.exe and then startede
with the serverexpl, windows services or the NET START command.

tryed also installing with installutil: it says there is no install packs.

how can I make my service work in design mode and in normal runtime mode?

thanks
 
when starting a windows service writte in vb.net, a messagebox appears:

cannot start service from the command line or a debugger. A windows
service must first be installed using installutil.exe and then startede
with the serverexpl, windows services or the NET START command.

tryed also installing with installutil: it says there is no install packs.

how can I make my service work in design mode and in normal runtime mode?

thanks
My answer consists in 2 parts:
- first part: install your service
- second part: start your service

You should install your Windows service with installutil like this:
- Open a Command Prompt window
- Go to the following directory:
C:\Windows\Microsoft.NET\Framework\v1.1.4322
- last folder can also be v1.0.3705 depending on your version of .NET
Framework (v1.1 or v1.0)
- Then type this (it is important to include the quotes " if the path
contains spaces!):
installutil "FolderName\ExecutableName.exe"
* FolderName is the folder that contains your executable, for instance
C:\Documents and Settings\Administrator\Visual Studio Projects\Solution1\bin
* ExecutableName is the name of the executable, for instance MyService

So your full command should be something like this:
C:
cd \
cd Windows\Microsoft.NET\Framework\v1.1.4322
installutil "C:\Documents and Settings\Administrator\Visual Studio
Projects\Solution1\bin\MyService.exe"

- Now your Windows service is installed.

You can start your service in several ways:
- Open a Command Prompt window and type:
net start MyService



Greetings
 
nobody said:
My answer consists in 2 parts:
- first part: install your service
- second part: start your service

well, as I said, install fails because there is no install package.
but the main problem is that I want to run the program in debug mode.

installog:
Installing assembly 'c:\data\sid\net\arubaservice\bin\arubaservice.exe'.
Affected parameters are:
assemblypath = c:\data\sid\net\arubaservice\bin\arubaservice.exe
logfile = c:\data\sid\net\arubaservice\bin\arubaservice.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could
be found in the c:\data\sid\net\arubaservice\bin\arubaservice.exe assembly.
Committing assembly 'c:\data\sid\net\arubaservice\bin\arubaservice.exe'.
Affected parameters are:
assemblypath = c:\data\sid\net\arubaservice\bin\arubaservice.exe
logfile = c:\data\sid\net\arubaservice\bin\arubaservice.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could
be found in the c:\data\sid\net\arubaservice\bin\arubaservice.exe assembly.
Remove InstallState file because there are no installers.
 
well, as I said, install fails because there is no install package.
but the main problem is that I want to run the program in debug mode.

installog:
Installing assembly 'c:\data\sid\net\arubaservice\bin\arubaservice.exe'.
Affected parameters are:
assemblypath = c:\data\sid\net\arubaservice\bin\arubaservice.exe
logfile = c:\data\sid\net\arubaservice\bin\arubaservice.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could
be found in the c:\data\sid\net\arubaservice\bin\arubaservice.exe
assembly.
Committing assembly 'c:\data\sid\net\arubaservice\bin\arubaservice.exe'.
Affected parameters are:
assemblypath = c:\data\sid\net\arubaservice\bin\arubaservice.exe
logfile = c:\data\sid\net\arubaservice\bin\arubaservice.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could
be found in the c:\data\sid\net\arubaservice\bin\arubaservice.exe
assembly.
Remove InstallState file because there are no installers.

Well, then your Service isn't finished. You have to add an Installer to
your service.

Do it like this:
- Go to the Design-view of your service and right-click your mouse. Choose
the option 'Add installer'.
- A new component shows up (ProjectInstaller.vb), on the Design-view of
that page, there are two other controls (ServiceProcessInstaller1 and
ServiceInstaller).
- Adjust these two components with your data
- Build your Service (Ctrl + Shift + B)
- Install it
- Run it!
- If you still receive errors after successfull installation, put an extra
line in your On_start event. Put this at the begin, then every time you
start the service it will ask you to select a debugger. This way you can
detect and solve the errors!
This is the line:
Debugger.Launch()


Greetings
 
nobody said:
Well, then your Service isn't finished. You have to add an Installer to
your service.

Do it like this:
- Go to the Design-view of your service and right-click your mouse. Choose
the option 'Add installer'.
- A new component shows up (ProjectInstaller.vb), on the Design-view of
that page, there are two other controls (ServiceProcessInstaller1 and
ServiceInstaller).
- Adjust these two components with your data
- Build your Service (Ctrl + Shift + B)
- Install it
- Run it!
- If you still receive errors after successfull installation, put an extra
line in your On_start event. Put this at the begin, then every time you
start the service it will ask you to select a debugger. This way you can
detect and solve the errors!
This is the line:
Debugger.Launch()


Greetings

ok, thanks, it works this way.
But if I start the program with "services", it does not show me
anything, and the program probably shows messageboxes to nowhere, and
the prgz remains locked waiting for user action. Is there any way to
make the prgz debuggable by vs?
 
SiD` said:
ok, thanks, it works this way.
But if I start the program with "services", it does not show me
anything, and the program probably shows messageboxes to nowhere, and
the prgz remains locked waiting for user action. Is there any way to
make the prgz debuggable by vs?

MsgBoxes do NOT belong in Windows Services, not even if you're
debugging them!!!

Rebuild your service in Debug Mode.
Reinstall it.
Put breakpoints into your code.
Start the Service, using Control Panel, let it get itself up and running,
then go back into the .Net IDE and Attach to the running process:

Menu: Debug > Processes
(find your process)
Click Attach

Your code /should/ now stop at the breakpoints you've defined.

HTH,
Phill W.
 
Back
Top