vb.net service debug start error

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
 
N

nobody

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
 
S

SiD`

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.
 
N

nobody

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
 
S

SiD`

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?
 
P

Phill. W

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top